From 3fa66571c76993dc1f9726703826c7dea73296bc Mon Sep 17 00:00:00 2001 From: Lucas Hoffmann Date: Mon, 8 Jan 2018 23:51:31 +0100 Subject: Use message of test assert function instead of print() This makes it possible to silence the test output with normal unittest settings (e.g. command line parameters). --- tests/settings/manager_test.py | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) (limited to 'tests/settings') diff --git a/tests/settings/manager_test.py b/tests/settings/manager_test.py index eb2f37fd..67c2a239 100644 --- a/tests/settings/manager_test.py +++ b/tests/settings/manager_test.py @@ -108,13 +108,10 @@ class TestSettingsManager(unittest.TestCase): if all([s in msg for s in unknown_settings]): success = True break - else: - print('Could not find all unknown settings in logging.info.\n' - 'Unknown settings:') - print(unknown_settings) - print('Calls to mocked logging.info:') - print(mock_logger.info.call_args_list) - self.assertTrue(success) + self.assertTrue(success, msg='Could not find all unknown settings in ' + 'logging.info.\nUnknown settings:\n{}\nCalls to mocked' + ' logging.info:\n{}'.format( + unknown_settings, mock_logger.info.call_args_list)) def test_read_notmuch_config_doesnt_exist(self): with tempfile.NamedTemporaryFile(delete=False) as f: -- cgit v1.2.3