diff options
author | Dylan Baker <baker.dylan.c@gmail.com> | 2015-06-15 11:42:07 -0700 |
---|---|---|
committer | Dylan Baker <baker.dylan.c@gmail.com> | 2015-08-10 11:44:29 -0700 |
commit | a5261b202be8eaee4110dc577ac23bd23c93560d (patch) | |
tree | ed4b0c4f6dd930b9d0cc6f860e5f948734afcbc5 | |
parent | f75b40af5eb85be0779e8dc876072b1cf7d41cb1 (diff) | |
download | piglit-a5261b202be8eaee4110dc577ac23bd23c93560d.tar.gz |
framework: remove _test_run_hook from Test
This was a design mistake from the start, subclassing the Test class and
overriding the run() method achieves the same result, without the need
for this hook
Signed-off-by: Dylan Baker <dylanx.c.baker@intel.com>
-rw-r--r-- | framework/test/base.py | 7 | ||||
-rw-r--r-- | framework/tests/dmesg_tests.py | 12 |
2 files changed, 11 insertions, 8 deletions
diff --git a/framework/test/base.py b/framework/test/base.py index b4ee4add3..276ef1c28 100644 --- a/framework/test/base.py +++ b/framework/test/base.py @@ -145,7 +145,7 @@ class Test(object): OPTS = Options() __metaclass__ = abc.ABCMeta __slots__ = ['run_concurrent', 'env', 'result', 'cwd', '_command', - '_test_hook_execute_run', '__proc_timeout'] + '__proc_timeout'] timeout = 0 def __init__(self, command, run_concurrent=False): @@ -158,10 +158,6 @@ class Test(object): self.cwd = None self.__proc_timeout = None - # This is a hook for doing some testing on execute right before - # self.run is called. - self._test_hook_execute_run = lambda: None - def execute(self, path, log, dmesg): """ Run a test @@ -180,7 +176,6 @@ class Test(object): try: time_start = time.time() dmesg.update_dmesg() - self._test_hook_execute_run() self.run() self.result['time'] = time.time() - time_start self.result = dmesg.update_result(self.result) diff --git a/framework/tests/dmesg_tests.py b/framework/tests/dmesg_tests.py index c264acb5a..55b0b2aab 100644 --- a/framework/tests/dmesg_tests.py +++ b/framework/tests/dmesg_tests.py @@ -402,6 +402,10 @@ def test_testclasses_dmesg(): def check_classes_dmesg(test_class, test_args): """ Do the actual check on the provided test class for dmesg """ + # There is so much magic in this test that pylint freaks out needlessly, + # please ignore all of those errors + # pylint: disable=no-init,too-few-public-methods,super-on-old-class + # pylint: disable=no-member if not os.path.exists('bin'): raise SkipTest("This tests requires a working, built version of " "piglit") @@ -409,8 +413,12 @@ def check_classes_dmesg(test_class, test_args): test = _get_dmesg() # Create the test and then write to dmesg to ensure that it actually works - test = test_class(test_args) - test._test_hook_execute_run = _write_dev_kmesg + class _localclass(test_class): + def run(self): + _write_dev_kmesg() + super(_localclass, self).run() + + test = _localclass(test_args) json = DummyJsonWriter() |