Rev 134: Merge together my two branches for my own needs in http://bazaar.launchpad.net/~jameinel/subunit

John Arbash Meinel john at arbash-meinel.com
Mon Aug 30 20:04:59 BST 2010


At http://bazaar.launchpad.net/~jameinel/subunit

------------------------------------------------------------
revno: 134 [merge]
revision-id: john at arbash-meinel.com-20100830190455-at2xnjcfmnzeoarq
parent: john at arbash-meinel.com-20100825001700-jy0r1lbbol5q5ja2
parent: john at arbash-meinel.com-20100824224112-u64oyzmjlc2gokxr
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: subunit
timestamp: Mon 2010-08-30 14:04:55 -0500
message:
  Merge together my two branches for my own needs
modified:
  NEWS                           news-20090720070100-bvo2f31ashh1uo9c-1
  filters/subunit-filter         subunitfilter-20090222074823-t2ktzmg7gg1ppkd3-1
  python/subunit/test_results.py test_results.py-20090722080328-fg8yxqfv365kx88d-1
-------------- next part --------------
=== modified file 'NEWS'
--- a/NEWS	2010-08-25 00:17:00 +0000
+++ b/NEWS	2010-08-30 19:04:55 +0000
@@ -5,6 +5,16 @@
 NEXT (In development)
 ---------------------
 
+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)
+
 IMPROVEMENTS
 ~~~~~~~~~~~~
 
@@ -13,6 +23,7 @@
   end up with 2k time statements doing nothing.
   (John Arbash Meinel, #623654)
 
+
 0.0.6
 -----
 

=== modified file 'filters/subunit-filter'
--- a/filters/subunit-filter	2009-10-25 07:05:21 +0000
+++ b/filters/subunit-filter	2010-08-24 22:41:12 +0000
@@ -51,18 +51,34 @@
     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-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("--no-success", action="store_true",
-    help="exclude successes", default=True, dest="success")
+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")
 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,
+    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):
@@ -94,7 +110,7 @@
 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)
 if options.no_passthrough:
     passthrough_stream = DiscardStream()

=== modified file 'python/subunit/test_results.py'
--- a/python/subunit/test_results.py	2010-08-25 00:17:00 +0000
+++ b/python/subunit/test_results.py	2010-08-30 19:04:55 +0000
@@ -212,7 +212,7 @@
     """
 
     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):
         """Create a FilterResult object filtering to result.
 
@@ -220,6 +220,7 @@
         :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
@@ -231,6 +232,7 @@
         self._filter_failure = filter_failure
         self._filter_success = filter_success
         self._filter_skip = filter_skip
+        self._filter_xfail = filter_xfail
         if filter_predicate is None:
             filter_predicate = lambda test, outcome, err, details: True
         self.filter_predicate = filter_predicate
@@ -280,9 +282,10 @@
             self._filtered()
 
     def addExpectedFailure(self, test, err=None, details=None):
-        if self.filter_predicate(test, 'expectedfailure', err, details):
+        if (not self._filter_xfail and
+            self.filter_predicate(test, 'expectedfailure', err, details)):
+            self.decorated.startTest(test)
             self._emitBufferedTime()
-            self.decorated.startTest(test)
             return self.decorated.addExpectedFailure(test, err,
                 details=details)
         else:



More information about the bazaar-commits mailing list