summaryrefslogtreecommitdiff
path: root/framework
diff options
context:
space:
mode:
authorDylan Baker <dylan@pnwbakers.com>2018-03-26 15:23:17 -0700
committerDylan Baker <dylan@pnwbakers.com>2018-05-01 14:27:49 -0700
commit9461d92301e72807eba4776a16a05207e3a16477 (patch)
tree884c36ae3c0c1e5c4634e3f4ac6be3d5b1660625 /framework
parent91b04a67ed64fcda3449bffe78dc9780c49f1c3e (diff)
framework/profile: Add a __len__ method to TestProfile
This exposes a standard interface for getting the number of tests in a profile, which is itself nice. It will also allow us to encapsulate the differences between the various profiles added in this series. Tested-by: Rafael Antognolli <rafael.antognolli@intel.com>
Diffstat (limited to 'framework')
-rw-r--r--framework/profile.py14
1 files changed, 7 insertions, 7 deletions
diff --git a/framework/profile.py b/framework/profile.py
index b6deed008..925271e82 100644
--- a/framework/profile.py
+++ b/framework/profile.py
@@ -284,6 +284,9 @@ class TestProfile(object):
'ignore_missing': False,
}
+ def __len__(self):
+ return sum(1 for _ in self.itertests())
+
def setup(self):
"""Method to do pre-run setup."""
@@ -381,15 +384,12 @@ def run(profiles, logger, backend, concurrency):
"""
chunksize = 1
- # The logger needs to know how many tests are running. Because of filters
- # there's no way to do that without making a concrete list out of the
- # filters profiles.
- profiles = [(p, list(p.itertests())) for p in profiles]
- log = LogManager(logger, sum(len(l) for _, l in profiles))
+ profiles = [(p, p.itertests()) for p in profiles]
+ log = LogManager(logger, sum(len(p) for p, _ in profiles))
# check that after the filters are run there are actually tests to run.
- if not any(l for _, l in profiles):
- raise exceptions.PiglitUserError('no matching tests')
+ # if not any(l for _, l in profiles):
+ # raise exceptions.PiglitUserError('no matching tests')
def test(name, test, profile, this_pool=None):
"""Function to call test.execute from map"""