diff options
| author | Jonathan Lange <jml@mumak.net> | 2012-04-13 00:12:32 +0100 |
|---|---|---|
| committer | Jonathan Lange <jml@mumak.net> | 2012-04-13 00:12:32 +0100 |
| commit | 994467ea854c08498baac63f01a653a240514526 (patch) | |
| tree | aee41464272a06c2e7973225186e91606be9f95f /python/subunit/test_results.py | |
| parent | 8141fda3abe0ba97903dca15a40f37dfa4eebcb7 (diff) | |
| download | subunit-git-994467ea854c08498baac63f01a653a240514526.tar.gz | |
Progress, of a sort.
Diffstat (limited to 'python/subunit/test_results.py')
| -rw-r--r-- | python/subunit/test_results.py | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/python/subunit/test_results.py b/python/subunit/test_results.py index 3e597ef..deaea1b 100644 --- a/python/subunit/test_results.py +++ b/python/subunit/test_results.py @@ -289,6 +289,22 @@ def and_predicates(predicates): return lambda *args, **kwargs: all(p(*args, **kwargs) for p in predicates) +def _make_tag_filter(with_tags, without_tags): + """Make a callback that checks tests against tags.""" + + with_tags = with_tags and set(with_tags) or None + without_tags = without_tags and set(without_tags) or None + + def check_tags(test, outcome, err, details, tags): + if with_tags and not with_tags <= tags: + return False + if without_tags and bool(without_tags & tags): + return False + return True + + return check_tags + + class _PredicateFilter(TestResultDecorator): def __init__(self, result, predicate): @@ -306,8 +322,8 @@ class _PredicateFilter(TestResultDecorator): def filter_predicate(self, test, outcome, error, details): # XXX: ExtendedToOriginalDecorator doesn't properly wrap current_tags. # https://bugs.launchpad.net/testtools/+bug/978027 - tags = getattr(self.decorated, 'current_tags', frozenset()) - return self._predicate(test, outcome, error, details, tags) + return self._predicate( + test, outcome, error, details, self.current_tags) def addError(self, test, err=None, details=None): if (self.filter_predicate(test, 'error', err, details)): @@ -538,7 +554,7 @@ class TestIdPrintingResult(testtools.TestResult): class TestByTestResult(testtools.TestResult): """Call something every time a test completes.""" - # XXX: Arguably belongs in testtools. +# XXX: Arguably belongs in testtools. def __init__(self, on_test): """Construct a ``TestByTestResult``. |
