summaryrefslogtreecommitdiff
path: root/filters
diff options
context:
space:
mode:
authorJohn Arbash Meinel <john@arbash-meinel.com>2011-06-30 13:58:30 +0200
committerJohn Arbash Meinel <john@arbash-meinel.com>2011-06-30 13:58:30 +0200
commit141bd28d1f8fb5858add01f4efdfcf0952de7f21 (patch)
tree2d89261cc9288daeb6ca49a087f718e80161d68b /filters
parent524ce5ab1b2c2636e6bc2b946a8f4ffb73333fd2 (diff)
downloadsubunit-141bd28d1f8fb5858add01f4efdfcf0952de7f21.tar.gz
Turn the -F handler into a callback that adds args.
By using 'insert', it means the options can then be overridden later. So doing subunit-filter -F --xfail will put the xfails in the stream, and you can do 'subunit-filter -F --passthrough' if you want the passthrough data back.
Diffstat (limited to 'filters')
-rwxr-xr-xfilters/subunit-filter23
1 files changed, 11 insertions, 12 deletions
diff --git a/filters/subunit-filter b/filters/subunit-filter
index 3cd1512..7f5620f 100755
--- a/filters/subunit-filter
+++ b/filters/subunit-filter
@@ -47,6 +47,8 @@ parser.add_option("--failure", action="store_false",
help="include failures", default=False, dest="failure")
parser.add_option("-f", "--no-failure", action="store_true",
help="exclude failures", dest="failure")
+parser.add_option("--passthrough", action="store_false",
+ help="Show all non subunit input.", default=False, dest="no_passthrough")
parser.add_option("--no-passthrough", action="store_true",
help="Hide all non subunit input.", default=False, dest="no_passthrough")
parser.add_option("-s", "--success", action="store_false",
@@ -69,21 +71,18 @@ parser.add_option("--fixup-expected-failures", type=str,
parser.add_option("--without", type=str,
help="regexp to exclude (case-sensitive by default)",
action="append", dest="without_regexps")
-# TODO: This could be done as a callback to allow following options to override
-# parts. As is, we just use it as a big hammer...
-parser.add_option("-F", "--only-genuine-failures", action="store_true",
- default=False,
+
+def only_genuine_failures_callback(option, opt, value, parser):
+ parser.rargs.insert(0, '--no-passthrough')
+ parser.rargs.insert(0, '--no-xfail')
+ parser.rargs.insert(0, '--no-skip')
+ parser.rargs.insert(0, '--no-success')
+
+parser.add_option("-F", "--only-genuine-failures", action="callback",
+ callback=only_genuine_failures_callback,
help="Only pass through failures and exceptions.")
(options, args) = parser.parse_args()
-if options.only_genuine_failures:
- options.success = True
- options.skip = True
- options.xfail = True
- options.no_passthrough = True
- # options.error = False
- # options.failures = False
-
def _compile_re_from_list(l):
return re.compile("|".join(l), re.MULTILINE)