Merge lp:~vila/bzr/419776-subunit into lp:bzr

Proposed by Vincent Ladeuil
Status: Merged
Approved by: John A Meinel
Approved revision: no longer in the source branch.
Merged at revision: not available
Proposed branch: lp:~vila/bzr/419776-subunit
Merge into: lp:bzr
Diff against target: 75 lines
2 files modified
NEWS (+3/-0)
bzrlib/tests/__init__.py (+18/-10)
To merge this branch: bzr merge lp:~vila/bzr/419776-subunit
Reviewer Review Type Date Requested Status
John A Meinel Approve
Review via email: mp+14413@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Vincent Ladeuil (vila) wrote :

As discussed with Robert on IRC, tested locally *with* subunit trunk.

Revision history for this message
John A Meinel (jameinel) wrote :

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Vincent Ladeuil wrote:
> Vincent Ladeuil has proposed merging lp:~vila/bzr/419776-subunit into lp:bzr.
>
> Requested reviews:
> bzr-core (bzr-core)
>
>
> As discussed with Robert on IRC, tested locally *with* subunit trunk.
>

If you've covered it with Robert, then
  review: approve
  merge: approve

The changes seem fine to me. Though how does this work if you had a
different version of subunit? Is it just the '_call_maybe' which handles
if using subunit 1.x rather than 1.y?

John
=:->

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkrxmEYACgkQJdeBCYSNAANKfQCeOeHKtuUx3af7XQ2giuAIWv0M
qSgAoJGbSLgu9tIcAoRzcQnKZfwcjsy8
=W+VF
-----END PGP SIGNATURE-----

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'NEWS'
2--- NEWS 2009-11-04 09:52:44 +0000
3+++ NEWS 2009-11-04 12:05:24 +0000
4@@ -47,6 +47,9 @@
5 * KnownFailure is now signalled to ``ExtendedTestResult`` using the same
6 method that Python 2.7 uses - ``addExpectedFailure``. (Robert Collins)
7
8+* ``--parallel=fork`` is now compatible with --subunit.
9+ (Robert Collins, Vincent Ladeuil, #419776)
10+
11 * TestNotApplicable is now handled within the TestCase.run method rather
12 than being looked for within ``ExtendedTestResult.addError``. This
13 provides better handling with other ``TestResult`` objects, degrading to
14
15=== modified file 'bzrlib/tests/__init__.py'
16--- bzrlib/tests/__init__.py 2009-11-01 05:52:16 +0000
17+++ bzrlib/tests/__init__.py 2009-11-04 12:05:24 +0000
18@@ -3250,10 +3250,6 @@
19 concurrency = osutils.local_concurrency()
20 result = []
21 from subunit import TestProtocolClient, ProtocolTestCase
22- try:
23- from subunit.test_results import AutoTimingTestResultDecorator
24- except ImportError:
25- AutoTimingTestResultDecorator = lambda x:x
26 class TestInOtherProcess(ProtocolTestCase):
27 # Should be in subunit, I think. RBC.
28 def __init__(self, stream, pid):
29@@ -3282,7 +3278,7 @@
30 sys.stdin.close()
31 sys.stdin = None
32 stream = os.fdopen(c2pwrite, 'wb', 1)
33- subunit_result = AutoTimingTestResultDecorator(
34+ subunit_result = BzrAutoTimingTestResultDecorator(
35 TestProtocolClient(stream))
36 process_suite.run(subunit_result)
37 finally:
38@@ -3412,6 +3408,22 @@
39 return value
40
41
42+try:
43+ from subunit.test_results import AutoTimingTestResultDecorator
44+ # Expected failure should be seen as a success not a failure Once subunit
45+ # provide native support for that, BZRTransformingResult and this class
46+ # will become useless.
47+ class BzrAutoTimingTestResultDecorator(AutoTimingTestResultDecorator):
48+
49+ def addExpectedFailure(self, test, err):
50+ self._before_event()
51+ return self._call_maybe("addExpectedFailure", self._degrade_skip,
52+ test, err)
53+except ImportError:
54+ # Let's just define a no-op decorator
55+ BzrAutoTimingTestResultDecorator = lambda x:x
56+
57+
58 class ProfileResult(ForwardingResult):
59 """Generate profiling data for all activity between start and success.
60
61@@ -4392,13 +4404,9 @@
62 # Only define SubUnitBzrRunner if subunit is available.
63 try:
64 from subunit import TestProtocolClient
65- try:
66- from subunit.test_results import AutoTimingTestResultDecorator
67- except ImportError:
68- AutoTimingTestResultDecorator = lambda x:x
69 class SubUnitBzrRunner(TextTestRunner):
70 def run(self, test):
71- result = AutoTimingTestResultDecorator(
72+ result = BzrAutoTimingTestResultDecorator(
73 TestProtocolClient(self.stream))
74 test.run(result)
75 return result