From 253b1bb4a434d293c1e4ddb958f65d3a9ab69395 Mon Sep 17 00:00:00 2001 From: Hynek Schlawack Date: Wed, 28 Sep 2022 10:23:36 +0200 Subject: [PATCH] Capture & assert over master branch warning --- src/towncrier/test/test_check.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/towncrier/test/test_check.py b/src/towncrier/test/test_check.py index f35c5cd4..9c7c7c81 100644 --- a/src/towncrier/test/test_check.py +++ b/src/towncrier/test/test_check.py @@ -4,6 +4,7 @@ import os import os.path import sys +import warnings from pathlib import Path from subprocess import PIPE, Popen, call @@ -293,8 +294,10 @@ def test_get_default_compare_branch_main(self): def test_get_default_compare_branch_fallback(self): """ - If there's origin/master and no main, use it. + If there's origin/master and no main, use it and warn about it. """ - branch = check._get_default_compare_branch(["origin/master", "origin/foo"]) + with warnings.catch_warnings(record=True) as w: + branch = check._get_default_compare_branch(["origin/master", "origin/foo"]) self.assertEqual("origin/master", branch) + self.assertTrue(w[0].message.args[0].startswith('Using "origin/master'))