Skip to content

Commit

Permalink
Update test_cq_description_format to check if warnings were printed
Browse files Browse the repository at this point in the history
  • Loading branch information
JokeWaumans committed Nov 25, 2024
1 parent 62bb682 commit feb643e
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions tests/test_integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -369,10 +369,14 @@ def test_cq_description_format(self, path_cwd_mock):
filename = 'code_quality_format.json'
out_file = str(TEST_OUT_DIR / filename)
ref_file = str(TEST_IN_DIR / filename)
retval = warnings_wrapper([
'--code-quality', out_file,
'--config', 'tests/test_in/config_cq_description_format.json',
'tests/test_in/mixed_warnings.txt',
])
with patch('sys.stdout', new=StringIO()) as fake_output:
retval = warnings_wrapper([
'--code-quality', out_file,
'--config', 'tests/test_in/config_cq_description_format.json',
'tests/test_in/mixed_warnings.txt',
])
output = fake_output.getvalue().splitlines(keepends=False)
self.assertIn("WARNING: Unrecognized classification 'max'", output)
self.assertIn("WARNING: Unrecognized classification 'min'", output)
self.assertEqual(2, retval)
self.assertTrue(filecmp.cmp(out_file, ref_file), '{} differs from {}'.format(out_file, ref_file))

0 comments on commit feb643e

Please sign in to comment.