summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
authorJonathan Lange <jml@mumak.net>2012-04-10 14:54:40 +0100
committerJonathan Lange <jml@mumak.net>2012-04-10 14:54:40 +0100
commit6de2212472caa1e7abab5b0a517aebbaf483141e (patch)
treeaa879f689e20b0c1ed014cb4f7a81fe8318925b0 /python
parent60d01e6fbb76c9e1ae5bcecd0a4ae6e96dfc3174 (diff)
downloadsubunit-git-6de2212472caa1e7abab5b0a517aebbaf483141e.tar.gz
Extract a helper.p
Diffstat (limited to 'python')
-rw-r--r--python/subunit/test_results.py16
1 files changed, 6 insertions, 10 deletions
diff --git a/python/subunit/test_results.py b/python/subunit/test_results.py
index 6c74ec3..3e597ef 100644
--- a/python/subunit/test_results.py
+++ b/python/subunit/test_results.py
@@ -20,6 +20,7 @@ import csv
import datetime
import testtools
+from testtools.compat import all
from testtools.content import (
text_content,
TracebackContent,
@@ -282,12 +283,10 @@ class TimeCollapsingDecorator(HookedTestResultDecorator):
self._last_received_time = a_time
-def all_true(bools):
- """Return True if all of 'bools' are True. False otherwise."""
- for b in bools:
- if not b:
- return False
- return True
+def and_predicates(predicates):
+ """Return a predicate that is true iff all predicates are true."""
+ # XXX: Should probably be in testtools to be better used by matchers. jml
+ return lambda *args, **kwargs: all(p(*args, **kwargs) for p in predicates)
class _PredicateFilter(TestResultDecorator):
@@ -444,10 +443,7 @@ class TestResultFilter(TestResultDecorator):
except TypeError:
return filter_predicate(test, outcome, error, details)
predicates.append(compat)
- predicate = (
- lambda test, outcome, err, details, tags:
- all_true(p(test, outcome, err, details, tags)
- for p in predicates))
+ predicate = and_predicates(predicates)
super(TestResultFilter, self).__init__(
_PredicateFilter(result, predicate))
if fixup_expected_failures is None: