summaryrefslogtreecommitdiff
path: root/framework
diff options
context:
space:
mode:
authorDylan Baker <dylan@pnwbakers.com>2016-10-05 15:19:35 -0700
committerDylan Baker <dylan@pnwbakers.com>2016-11-10 10:49:09 -0800
commit0cd04585999b54b56ee0d9cf8c4a5ad03bf62497 (patch)
tree5195851d88990395eb5695d28d1baec9e30f0aa5 /framework
parent1d03dd4247894841418838bfc40aed2d508b634a (diff)
framework/profile: make run hooks public
These are used in a couple of places, and since they're meant to be changed by subclasses they need to be public. Signed-off-by: Dylan Baker <dylanx.c.baker@intel.com>
Diffstat (limited to 'framework')
-rw-r--r--framework/profile.py28
1 files changed, 8 insertions, 20 deletions
diff --git a/framework/profile.py b/framework/profile.py
index 7b0cb0778..0d2e1cf26 100644
--- a/framework/profile.py
+++ b/framework/profile.py
@@ -287,22 +287,6 @@ class TestProfile(object):
raise exceptions.PiglitFatalError(
'There are no tests scheduled to run. Aborting run.')
- def _pre_run_hook(self):
- """ Hook executed at the start of TestProfile.run
-
- To make use of this hook one will need to subclass TestProfile, and
- set this to do something, as be default it will no-op
- """
- pass
-
- def _post_run_hook(self):
- """ Hook executed at the end of TestProfile.run
-
- To make use of this hook one will need to subclass TestProfile, and
- set this to do something, as be default it will no-op
- """
- pass
-
def run(self, logger, backend):
""" Runs all tests using Thread pool
@@ -321,8 +305,6 @@ class TestProfile(object):
"""
- self._pre_run_hook()
-
chunksize = 1
self._prepare_test_list()
@@ -350,6 +332,7 @@ class TestProfile(object):
single = multiprocessing.dummy.Pool(1)
multi = multiprocessing.dummy.Pool()
+ self.setup()
try:
if options.OPTIONS.concurrent == "all":
run_threads(multi, six.iteritems(self.test_list))
@@ -371,8 +354,7 @@ class TestProfile(object):
# then die. Pressing C-c again will kill immediately.
log.get().summary()
raise
-
- self._post_run_hook()
+ self.teardown()
if self._monitoring.abort_needed:
raise exceptions.PiglitAbort(self._monitoring.error_message)
@@ -482,6 +464,12 @@ class TestProfile(object):
with self.test_list.allow_reassignment:
yield
+ def setup(self):
+ """Method to do pre-run setup."""
+
+ def teardown(self):
+ """Method to od post-run teardown."""
+
def load_test_profile(filename):
"""Load a python module and return it's profile attribute.