TestProtocolClient,
read_test_list,
)
-from subunit.test_results import TestResultFilter
+from subunit.test_results import (
+ and_predicates,
+ _make_tag_filter,
+ TestResultFilter,
+ )
parser = OptionParser(description=__doc__)
parser.add_option("--error", action="store_false",
help="include expected falures", default=True, dest="xfail")
parser.add_option("--no-xfail", action="store_true",
help="exclude expected falures", default=True, dest="xfail")
+parser.add_option(
+ "--with-tag", type=str,
+ help="include tests with these tags", action="append", dest="with_tags")
+parser.add_option(
+ "--without-tag", type=str,
+ help="exclude tests with these tags", action="append", dest="without_tags")
parser.add_option("-m", "--with", type=str,
help="regexp to include (case-sensitive by default)",
action="append", dest="with_regexps")
regexp_filter = _make_regexp_filter(options.with_regexps,
options.without_regexps)
+tag_filter = _make_tag_filter(options.with_tags, options.without_tags)
+
+filter_predicate = and_predicates([regexp_filter, tag_filter])
+
fixup_expected_failures = set()
for path in options.fixup_expected_failures or ():
fixup_expected_failures.update(read_test_list(path))
result = TestResultFilter(result, filter_error=options.error,
filter_failure=options.failure, filter_success=options.success,
filter_skip=options.skip, filter_xfail=options.xfail,
- filter_predicate=regexp_filter,
+ filter_predicate=tag_filter,
fixup_expected_failures=fixup_expected_failures)
if options.no_passthrough:
passthrough_stream = DiscardStream()