diff options
| author | Robert Collins <robertc@robertcollins.net> | 2011-10-31 20:56:59 +1300 |
|---|---|---|
| committer | Robert Collins <robertc@robertcollins.net> | 2011-10-31 20:56:59 +1300 |
| commit | 81aa7596833daa779ddfb3eb352e9b8c64e947c6 (patch) | |
| tree | e0ee358d56b3bc39c11b0d3ec1dd6b63af19c02a | |
| parent | 0401a214b905783cbbbd5527a98a11eff49dff5e (diff) | |
| parent | d85610fab1b0ed73df9b59f813ff7cd683d6e101 (diff) | |
| download | subunit-git-81aa7596833daa779ddfb3eb352e9b8c64e947c6.tar.gz | |
Merge trunk work that had gotten diverged.
| -rw-r--r-- | NEWS | 18 | ||||
| -rwxr-xr-x | filters/subunit-filter | 23 | ||||
| -rw-r--r-- | perl/lib/Subunit.pm | 2 | ||||
| -rw-r--r-- | python/subunit/__init__.py | 4 | ||||
| -rwxr-xr-x | python/subunit/run.py | 2 | ||||
| -rw-r--r-- | python/subunit/test_results.py | 5 | ||||
| -rw-r--r-- | shell/share/subunit.sh | 5 |
7 files changed, 49 insertions, 10 deletions
@@ -5,6 +5,23 @@ subunit release notes NEXT (In development) --------------------- +IMPROVEMENTS +~~~~~~~~~~~~ + +* Perl module now correctly outputs "failure" instead of "fail". (Stewart Smith) + +* Shell functions now output timestamps. (Stewart Smith) + +BUG FIXES +~~~~~~~~~ + +* Add 'subunit --no-xfail', which will omit expected failures from the subunit + stream. (John Arbash Meinel, #623642) + +* Add 'subunit -F/--only-genuine-failures' which sets all of '--no-skips', + '--no-xfail', '--no-passthrough, '--no-success', and gives you just the + failure stream. (John Arbash Meinel) + 0.0.7 ----- @@ -67,7 +84,6 @@ IMPROVEMENTS * The Python2.7 / testtools addUnexpectedSuccess API is now supported. This required adding a new status code to the protocol. (Robert Collins, #654474) -======= CHANGES ~~~~~~~ diff --git a/filters/subunit-filter b/filters/subunit-filter index 5993d48..7f5620f 100755 --- a/filters/subunit-filter +++ b/filters/subunit-filter @@ -47,14 +47,20 @@ 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", help="include successes", dest="success") -parser.add_option("--no-skip", action="store_true", - help="exclude skips", dest="skip") parser.add_option("--no-success", action="store_true", help="exclude successes", default=True, dest="success") +parser.add_option("--no-skip", action="store_true", + help="exclude skips", dest="skip") +parser.add_option("--xfail", 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("-m", "--with", type=str, help="regexp to include (case-sensitive by default)", action="append", dest="with_regexps") @@ -66,8 +72,17 @@ parser.add_option("--without", type=str, help="regexp to exclude (case-sensitive by default)", action="append", dest="without_regexps") -(options, args) = parser.parse_args() +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() def _compile_re_from_list(l): return re.compile("|".join(l), re.MULTILINE) @@ -101,7 +116,7 @@ for path in options.fixup_expected_failures or (): result = TestProtocolClient(sys.stdout) result = TestResultFilter(result, filter_error=options.error, filter_failure=options.failure, filter_success=options.success, - filter_skip=options.skip, + filter_skip=options.skip, filter_xfail=options.xfail, filter_predicate=regexp_filter, fixup_expected_failures=fixup_expected_failures) if options.no_passthrough: diff --git a/perl/lib/Subunit.pm b/perl/lib/Subunit.pm index dac4a26..72aa1eb 100644 --- a/perl/lib/Subunit.pm +++ b/perl/lib/Subunit.pm @@ -135,7 +135,7 @@ sub fail_test($;$) { my $name = shift; my $reason = shift; - end_test($name, "fail", $reason); + end_test($name, "failure", $reason); } sub success_test($;$) diff --git a/python/subunit/__init__.py b/python/subunit/__init__.py index 414b368..b4c9397 100644 --- a/python/subunit/__init__.py +++ b/python/subunit/__init__.py @@ -59,12 +59,12 @@ and newer). The ``tags(new_tags, gone_tags)`` method is called (if present) to add or remove tags in the test run that is currently executing. If called when no test is in progress (that is, if called outside of the ``startTest``, -``stopTest`` pair), the the tags apply to all sebsequent tests. If called +``stopTest`` pair), the the tags apply to all subsequent tests. If called when a test is in progress, then the tags only apply to that test. The ``time(a_datetime)`` method is called (if present) when a ``time:`` directive is encountered in a Subunit stream. This is used to tell a TestResult -about the time that events in the stream occured at, to allow reconstructing +about the time that events in the stream occurred at, to allow reconstructing test timing from a stream. The ``progress(offset, whence)`` method controls progress data for a stream. diff --git a/python/subunit/run.py b/python/subunit/run.py index b390de3..51d6837 100755 --- a/python/subunit/run.py +++ b/python/subunit/run.py @@ -49,7 +49,7 @@ class SubunitTestProgram(TestProgram): def usageExit(self, msg=None): if msg: - print msg + print (msg) usage = {'progName': self.progName, 'catchbreak': '', 'failfast': '', 'buffer': ''} if self.failfast != False: diff --git a/python/subunit/test_results.py b/python/subunit/test_results.py index 9f64544..33fb50e 100644 --- a/python/subunit/test_results.py +++ b/python/subunit/test_results.py @@ -294,7 +294,7 @@ class TestResultFilter(TestResultDecorator): """ def __init__(self, result, filter_error=False, filter_failure=False, - filter_success=True, filter_skip=False, + filter_success=True, filter_skip=False, filter_xfail=False, filter_predicate=None, fixup_expected_failures=None): """Create a FilterResult object filtering to result. @@ -302,6 +302,7 @@ class TestResultFilter(TestResultDecorator): :param filter_failure: Filter out failures. :param filter_success: Filter out successful tests. :param filter_skip: Filter out skipped tests. + :param filter_xfail: Filter out expected failure tests. :param filter_predicate: A callable taking (test, outcome, err, details) and returning True if the result should be passed through. err and details may be none if no error or extra @@ -322,6 +323,8 @@ class TestResultFilter(TestResultDecorator): predicates.append(lambda t, outcome, e, d: outcome != 'success') if filter_skip: predicates.append(lambda t, outcome, e, d: outcome != 'skip') + if filter_xfail: + predicates.append(lambda t, outcome, e, d: outcome != 'expectedfailure') if filter_predicate is not None: predicates.append(filter_predicate) self.filter_predicate = ( diff --git a/shell/share/subunit.sh b/shell/share/subunit.sh index 8273727..a532388 100644 --- a/shell/share/subunit.sh +++ b/shell/share/subunit.sh @@ -16,12 +16,14 @@ subunit_start_test () { # emit the current protocol start-marker for test $1 + echo "time: `date -u '+%Y-%m-%d %H:%M:%SZ'`" echo "test: $1" } subunit_pass_test () { # emit the current protocol test passed marker for test $1 + echo "time: `date -u '+%Y-%m-%d %H:%M:%SZ'`" echo "success: $1" } @@ -31,6 +33,7 @@ subunit_fail_test () { # the error text. # we use stdin because the failure message can be arbitrarily long, and this # makes it convenient to write in scripts (using <<END syntax. + echo "time: `date -u '+%Y-%m-%d %H:%M:%SZ'`" echo "failure: $1 [" cat - echo "]" @@ -42,6 +45,7 @@ subunit_error_test () { # the error text. # we use stdin because the failure message can be arbitrarily long, and this # makes it convenient to write in scripts (using <<END syntax. + echo "time: `date -u '+%Y-%m-%d %H:%M:%SZ'`" echo "error: $1 [" cat - echo "]" @@ -50,6 +54,7 @@ subunit_error_test () { subunit_skip_test () { # emit the current protocol test skipped marker for test $1 + echo "time: `date -u '+%Y-%m-%d %H:%M:%SZ'`" echo "skip: $1" } |
