diff --git a/tests/test_in/config_example_polyspace_error.yml b/tests/test_in/config_example_polyspace_error.yml new file mode 100644 index 00000000..db7e1ca9 --- /dev/null +++ b/tests/test_in/config_example_polyspace_error.yml @@ -0,0 +1,43 @@ +sphinx: + enabled: true + min: 0 + max: 0 + exclude: + - RemovedInSphinx\d+Warning + - 'WARNING: toctree' +doxygen: + enabled: false +junit: + enabled: false +xmlrunner: + enabled: false +coverity: + enabled: false +robot: + enabled: false +polyspace: + enabled: true + run-time check: + - color: red + min: 0 + max: 0 + - color: orange + min: 0 + max: 10 + global variable: + - color: red + min: 0 + max: 0 + - color: orange + min: 0 + max: 10 + defect: + - information: 'impact: high' + min: 0 + max: 0 + - information: 'impact: medium' + min: 0 + max: 10 + - information: 'impact: low' + min: 0 + max: 30 diff --git a/tests/test_integration.py b/tests/test_integration.py index 5b1f6c48..4a866bd3 100644 --- a/tests/test_integration.py +++ b/tests/test_integration.py @@ -6,7 +6,7 @@ from unittest.mock import patch -from mlx.warnings import warnings_wrapper, WarningsConfigError, Finding +from mlx.warnings import exceptions, warnings_wrapper, WarningsConfigError, Finding TEST_IN_DIR = Path(__file__).parent / 'test_in' TEST_OUT_DIR = Path(__file__).parent / 'test_out' @@ -380,3 +380,16 @@ def test_cq_description_format(self, path_cwd_mock): 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)) + + @patch('pathlib.Path.cwd') + def test_polyspace_error(self, path_cwd_mock): + config_file = str(TEST_IN_DIR / 'config_example_polyspace_error.yml') + cq_file = str(TEST_IN_DIR / 'test.json') + with self.assertRaises(exceptions.WarningsConfigError) as context: + warnings_wrapper([ + '--code-quality', cq_file, + '--config', config_file, + 'tests/test_in/mixed_warnings.txt', + ]) + self.assertEqual(str(context.exception), 'Polyspace checker cannot be combined with other warnings checkers') +