summaryrefslogtreecommitdiff
path: root/framework
diff options
context:
space:
mode:
authorDylan Baker <dylan@pnwbakers.com>2018-05-08 14:05:49 -0700
committerDylan Baker <dylan@pnwbakers.com>2018-05-09 11:10:32 -0700
commitdddfbdfe5689bde8cd43a086a530c362de669ccd (patch)
treef7173375835525132003d64eff12f67377e432a3 /framework
parent1f0f2ad25ecbfdcb09ec764404ec365c6b6946c1 (diff)
framework: make use of Filter.run in Profile classes
Tested-by: Michel Dänzer <michel.daenzer@amd.com>
Diffstat (limited to 'framework')
-rw-r--r--framework/profile.py37
1 files changed, 21 insertions, 16 deletions
diff --git a/framework/profile.py b/framework/profile.py
index b0233866b..aff0ffa2c 100644
--- a/framework/profile.py
+++ b/framework/profile.py
@@ -369,17 +369,20 @@ class XMLProfile(object):
def _itertests(self):
"""Always iterates tests instead of using the forced test_list."""
- with gzip.open(self.filename, 'rt') as f:
- doc = et.iterparse(f, events=(b'end', ))
- _, root = next(doc) # get the root so we can keep clearing it
- for _, e in doc:
- if e.tag != 'Test':
- continue
- k = e.attrib['name']
- v = make_test(e)
- if all(f(k, v) for f in self.filters):
+ def _iter():
+ with gzip.open(self.filename, 'rt') as f:
+ doc = et.iterparse(f, events=(b'end', ))
+ _, root = next(doc) # get the root so we can keep clearing it
+ for _, e in doc:
+ if e.tag != 'Test':
+ continue
+ k = e.attrib['name']
+ v = make_test(e)
yield k, v
- root.clear()
+ root.clear()
+
+ for k, v in self.filters.run(_iter()):
+ yield k, v
def itertests(self):
if self.forced_test_list:
@@ -432,11 +435,14 @@ class MetaProfile(object):
pass
def _itertests(self):
- for p in self._profiles:
- for k, v in p.itertests():
- if all(f(k, v) for f in self.filters):
+ def _iter():
+ for p in self._profiles:
+ for k, v in p.itertests():
yield k, v
+ for k, v in self.filters.run(_iter()):
+ yield k, v
+
def itertests(self):
if self.forced_test_list:
alltests = dict(self._itertests())
@@ -516,9 +522,8 @@ class TestProfile(object):
else:
opts = self.test_list # pylint: disable=redefined-variable-type
- for k, v in six.iteritems(opts):
- if all(f(k, v) for f in self.filters):
- yield k, v
+ for k, v in self.filters.run(six.iteritems(opts)):
+ yield k, v
def load_test_profile(filename, python=None):