[Piglit] [PATCH v3 16/28] framework/profile: Factor out check_all closure
Dylan Baker
dylan at pnwbakers.com
Mon Oct 31 17:50:12 UTC 2016
This does away with the check_all closure, by simplifying it down to an
equivalent lambda expression.
Signed-off-by: Dylan Baker <dylanx.c.baker at intel.com>
---
framework/profile.py | 14 +++-----------
1 file changed, 3 insertions(+), 11 deletions(-)
diff --git a/framework/profile.py b/framework/profile.py
index f47282c..b6c2b0e 100644
--- a/framework/profile.py
+++ b/framework/profile.py
@@ -205,7 +205,7 @@ class TestDict(collections.MutableMapping):
"""
for k, v in list(six.iteritems(self)):
- if not callable((k, v)):
+ if not callable(k, v):
del self[k]
def reorder(self, order):
@@ -292,23 +292,15 @@ class TestProfile(object):
runs it's own filters plus the filters in the self.filters name
"""
- def check_all(item):
- """ Checks group and test name against all filters """
- path, test = item
- for f in self.filters:
- if not f(path, test):
- return False
- return True
-
if self.forced_test_list:
# Remove all tests not in the test list, then reorder the tests to
# match the testlist. This still allows additional filters to be
# run afterwards.
- self.test_list.filter(lambda i: i[0] in self.forced_test_list)
+ self.test_list.filter(lambda n, _: n in self.forced_test_list)
self.test_list.reorder(self.forced_test_list)
# Filter out unwanted tests
- self.test_list.filter(check_all)
+ self.test_list.filter(lambda n, t: all(f(n, t) for f in self.filters))
if not self.test_list:
raise exceptions.PiglitFatalError(
--
git-series 0.8.10
More information about the Piglit
mailing list