From 73ed085e7acbada5fc57c977a5726e666453d767 Mon Sep 17 00:00:00 2001 From: John Vandenberg Date: Tue, 30 Oct 2018 20:28:43 +0700 Subject: [PATCH] LinterTest: Split into several classes --- tests/bearlib/abstractions/LinterTest.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/tests/bearlib/abstractions/LinterTest.py b/tests/bearlib/abstractions/LinterTest.py index 37bba1d060..d6d87319c7 100644 --- a/tests/bearlib/abstractions/LinterTest.py +++ b/tests/bearlib/abstractions/LinterTest.py @@ -28,7 +28,7 @@ def get_testfile_name(name): name) -class LinterComponentTest(unittest.TestCase): +class LinterTestBase(unittest.TestCase): PARAM_TYPE_ERROR_RE = '[A-Za-z_]+ must be an instance of one of .*' @@ -60,6 +60,9 @@ def process_output(self, *args, **kwargs): def setUp(self): self.section = Section('TEST_SECTION') + +class LinterDecoratorTest(LinterTestBase): + def test_decorator_invalid_parameters(self): with self.assertRaisesRegex(ValueError, 'Invalid keyword arguments provided: ' @@ -273,6 +276,9 @@ def test_check_prerequisites(self): (self.ManualProcessingTestLinter)) self.assertEqual(uut.check_prerequisites(), 'NOPE') + +class LinterRunTest(LinterTestBase): + def test_output_stream(self): process_output_mock = Mock() @@ -815,6 +821,9 @@ def test_minimal_regex(self): self.assertEqual(results, [Result.from_values('EmptyTestLinter', '', file='file')]) + +class LinterSettingsTest(LinterTestBase): + def test_get_non_optional_settings(self): class Handler(self.ManualProcessingTestLinter): @@ -971,6 +980,9 @@ def generate_config(filename, file, val): self.assertEqual(fl.read(), 'config_value = 88') self.assertFalse(os.path.isfile(config_file)) + +class LinterOtherTest(LinterTestBase): + def test_metaclass_repr(self): uut = linter('my-tool')(self.ManualProcessingTestLinter) self.assertEqual(