diff options
author | Jelmer Vernooij <jelmer@samba.org> | 2011-04-11 15:32:47 +0200 |
---|---|---|
committer | Jelmer Vernooij <jelmer@samba.org> | 2011-04-11 15:32:47 +0200 |
commit | c50f4c8e7b10796dec12504b783bba85c75b23c9 (patch) | |
tree | b7b64e2d6ec27a9d75997bd7cc56d3c654c4554a /filters | |
parent | 22376467db48b23dabef38b55f5316dd5cd9b89b (diff) | |
download | subunit-c50f4c8e7b10796dec12504b783bba85c75b23c9.tar.gz |
Support --fixup-expected-failures argument to subunit-filter.
Diffstat (limited to 'filters')
-rwxr-xr-x | filters/subunit-filter | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/filters/subunit-filter b/filters/subunit-filter index dcd63fa..f5e6acf 100755 --- a/filters/subunit-filter +++ b/filters/subunit-filter @@ -28,7 +28,6 @@ Remember to quote shell metacharacters. from optparse import OptionParser import sys -import unittest import re from subunit import ( @@ -58,6 +57,10 @@ parser.add_option("--no-success", action="store_true", parser.add_option("-m", "--with", type=str, help="regexp to include (case-sensitive by default)", action="append", dest="with_regexps") +parser.add_option("--fixup-expected-failures", type=str, + help="File with list of test ids that are expected to fail; on failure " + "their result will be changed to xfail; on success they will be " + "changed to error.", dest="fixup_expected_failures", action="append") parser.add_option("--without", type=str, help="regexp to exclude (case-sensitive by default)", action="append", dest="without_regexps") @@ -89,13 +92,24 @@ def _make_regexp_filter(with_regexps, without_regexps): return check_regexps +def read_test_list(path): + f = open(path, 'rb') + try: + return [l.rstrip("\n") for l in f.readlines()] + finally: + f.close() + regexp_filter = _make_regexp_filter(options.with_regexps, options.without_regexps) +fixup_expected_failures = set() +for path in options.fixup_expected_failures: + fixup_expected_failures.update(read_test_list(path)) result = TestProtocolClient(sys.stdout) result = TestResultFilter(result, filter_error=options.error, filter_failure=options.failure, filter_success=options.success, filter_skip=options.skip, - filter_predicate=regexp_filter) + filter_predicate=regexp_filter, + filter_expected_failures=fixup_expected_failures) if options.no_passthrough: passthrough_stream = DiscardStream() else: |