Skip to content

Commit

Permalink
LinterTest: Split into several classes
Browse files Browse the repository at this point in the history
  • Loading branch information
jayvdb committed Oct 30, 2018
1 parent 05b6dae commit 73ed085
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion tests/bearlib/abstractions/LinterTest.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 .*'

Expand Down Expand Up @@ -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: '
Expand Down Expand Up @@ -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()

Expand Down Expand Up @@ -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):

Expand Down Expand Up @@ -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(
Expand Down

0 comments on commit 73ed085

Please sign in to comment.