mirror of
https://gitlab.com/apparmor/apparmor
synced 2025-08-22 10:07:12 +00:00
Merge Drop unused AAParseTest class and setup_regex_tests()
In the past, this class and function were used by test-signal_parse.py - which was deleted in April 2016 (5f58d7f124139784b9ba70ce37cc26716bbc4e0f). Maybe there were also other users, but none of them survived. MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/1719 Approved-by: Ryan Lee <rlee287@yahoo.com> Merged-by: Christian Boltz <apparmor@cboltz.de>
This commit is contained in:
commit
7a8a28d47a
@ -54,18 +54,6 @@ class AATest(unittest.TestCase):
|
||||
tmpdir = None
|
||||
|
||||
|
||||
class AAParseTest(unittest.TestCase):
|
||||
parse_function = None
|
||||
|
||||
def _test_parse_rule(self, rule):
|
||||
self.assertIsNot(self.parse_function, 'Test class did not set a parse_function')
|
||||
parsed = self.parse_function(rule)
|
||||
self.assertEqual(
|
||||
rule, parsed.serialize(),
|
||||
'parse object {} returned "{}", expected "{}"'.format(
|
||||
self.parse_function.__doc__, parsed.serialize(), rule))
|
||||
|
||||
|
||||
def setup_all_loops(module_name):
|
||||
"""call setup_tests_loop() for each class in module_name"""
|
||||
for name, obj in inspect.getmembers(sys.modules[module_name]):
|
||||
@ -93,19 +81,6 @@ def setup_tests_loop(test_class):
|
||||
setattr(test_class, 'test_{}'.format(i), stub_test)
|
||||
|
||||
|
||||
def setup_regex_tests(test_class):
|
||||
"""Create tests in test_class using test_class.tests and AAParseTest._test_parse_rule()
|
||||
|
||||
test_class.tests should be tuples of (line, description)
|
||||
"""
|
||||
for (i, (line, desc)) in enumerate(test_class.tests):
|
||||
def stub_test(self, line=line):
|
||||
self._test_parse_rule(line)
|
||||
|
||||
stub_test.__doc__ = "test '{}': {}".format(line, desc)
|
||||
setattr(test_class, 'test_{}'.format(i), stub_test)
|
||||
|
||||
|
||||
def setup_aa(aa):
|
||||
confdir = os.getenv('__AA_CONFDIR')
|
||||
if confdir:
|
||||
|
Loading…
x
Reference in New Issue
Block a user