Skip to content

Commit ff5b206

Browse files
committed
Capture & assert over master branch warning
1 parent d394d77 commit ff5b206

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

src/towncrier/newsfragments/434.misc

Whitespace-only changes.

src/towncrier/test/test_check.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import os
55
import os.path
66
import sys
7+
import warnings
78

89
from pathlib import Path
910
from subprocess import PIPE, Popen, call
@@ -293,8 +294,10 @@ def test_get_default_compare_branch_main(self):
293294

294295
def test_get_default_compare_branch_fallback(self):
295296
"""
296-
If there's origin/master and no main, use it.
297+
If there's origin/master and no main, use it and warn about it.
297298
"""
298-
branch = check._get_default_compare_branch(["origin/master", "origin/foo"])
299+
with warnings.catch_warnings(record=True) as w:
300+
branch = check._get_default_compare_branch(["origin/master", "origin/foo"])
299301

300302
self.assertEqual("origin/master", branch)
303+
self.assertTrue(w[0].message.args[0].startswith('Using "origin/master'))

0 commit comments

Comments
 (0)