Rev 4793: Merge in Vincent's work to make subunit compatible with expectedFailures. in http://bazaar.launchpad.net/~jameinel/bzr/2.1.0b4-win32-test-suite
John Arbash Meinel
john at arbash-meinel.com
Sun Nov 8 01:31:46 GMT 2009
At http://bazaar.launchpad.net/~jameinel/bzr/2.1.0b4-win32-test-suite
------------------------------------------------------------
revno: 4793 [merge]
revision-id: john at arbash-meinel.com-20091108013044-astr2p91su63q8yi
parent: john at arbash-meinel.com-20091108011558-7dazv0waroq8rkqp
parent: v.ladeuil+lp at free.fr-20091104115935-0fw5swdj80pasnir
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: 2.1.0b4-win32-test-suite
timestamp: Sat 2009-11-07 19:30:44 -0600
message:
Merge in Vincent's work to make subunit compatible with expectedFailures.
modified:
NEWS NEWS-20050323055033-4e00b5db738777ff
bzrlib/tests/__init__.py selftest.py-20050531073622-8d0e3c8845c97a64
-------------- next part --------------
=== modified file 'NEWS'
--- a/NEWS 2009-11-05 20:08:36 +0000
+++ b/NEWS 2009-11-08 01:30:44 +0000
@@ -59,6 +59,9 @@
* KnownFailure is now signalled to ``ExtendedTestResult`` using the same
method that Python 2.7 uses - ``addExpectedFailure``. (Robert Collins)
+* ``--parallel=fork`` is now compatible with --subunit.
+ (Robert Collins, Vincent Ladeuil, #419776)
+
* TestNotApplicable is now handled within the TestCase.run method rather
than being looked for within ``ExtendedTestResult.addError``. This
provides better handling with other ``TestResult`` objects, degrading to
=== modified file 'bzrlib/tests/__init__.py'
--- a/bzrlib/tests/__init__.py 2009-11-08 00:48:25 +0000
+++ b/bzrlib/tests/__init__.py 2009-11-08 01:30:44 +0000
@@ -3250,10 +3250,6 @@
concurrency = osutils.local_concurrency()
result = []
from subunit import TestProtocolClient, ProtocolTestCase
- try:
- from subunit.test_results import AutoTimingTestResultDecorator
- except ImportError:
- AutoTimingTestResultDecorator = lambda x:x
class TestInOtherProcess(ProtocolTestCase):
# Should be in subunit, I think. RBC.
def __init__(self, stream, pid):
@@ -3282,7 +3278,7 @@
sys.stdin.close()
sys.stdin = None
stream = os.fdopen(c2pwrite, 'wb', 1)
- subunit_result = AutoTimingTestResultDecorator(
+ subunit_result = BzrAutoTimingTestResultDecorator(
TestProtocolClient(stream))
process_suite.run(subunit_result)
finally:
@@ -3412,6 +3408,22 @@
return value
+try:
+ from subunit.test_results import AutoTimingTestResultDecorator
+ # Expected failure should be seen as a success not a failure Once subunit
+ # provide native support for that, BZRTransformingResult and this class
+ # will become useless.
+ class BzrAutoTimingTestResultDecorator(AutoTimingTestResultDecorator):
+
+ def addExpectedFailure(self, test, err):
+ self._before_event()
+ return self._call_maybe("addExpectedFailure", self._degrade_skip,
+ test, err)
+except ImportError:
+ # Let's just define a no-op decorator
+ BzrAutoTimingTestResultDecorator = lambda x:x
+
+
class ProfileResult(ForwardingResult):
"""Generate profiling data for all activity between start and success.
@@ -4394,13 +4406,9 @@
# Only define SubUnitBzrRunner if subunit is available.
try:
from subunit import TestProtocolClient
- try:
- from subunit.test_results import AutoTimingTestResultDecorator
- except ImportError:
- AutoTimingTestResultDecorator = lambda x:x
class SubUnitBzrRunner(TextTestRunner):
def run(self, test):
- result = AutoTimingTestResultDecorator(
+ result = BzrAutoTimingTestResultDecorator(
TestProtocolClient(self.stream))
test.run(result)
return result
More information about the bazaar-commits
mailing list