Merge lp:~gz/bzr/trivial_subunit_unexpectedly_correct into lp:bzr

Proposed by Martin Packman
Status: Merged
Approved by: Vincent Ladeuil
Approved revision: no longer in the source branch.
Merged at revision: 5898
Proposed branch: lp:~gz/bzr/trivial_subunit_unexpectedly_correct
Merge into: lp:bzr
Diff against target: 20 lines (+7/-3)
1 file modified
bzrlib/tests/test_selftest.py (+7/-3)
To merge this branch: bzr merge lp:~gz/bzr/trivial_subunit_unexpectedly_correct
Reviewer Review Type Date Requested Status
Vincent Ladeuil Approve
Review via email: mp+61470@code.launchpad.net

Commit message

Stop expecting subunit to get unexpected successes wrong if it has the recent fix.

Description of the change

Per bug 654474 subunit used to treat unexpected successes as successes rather than failures, and when John wrote some tests for logs being kept or discarded in subunit streams, he had to add an expectFailure for this case. Now that it's fixed in subunit (but not in a released version), that check unexpectedly passes with a trunk subunit. And as Bazaar now treats unexpected successes as failures too...

There doesn't seem to be a neat way of checking the subunit version, and we don't require a minimum subunit version for `bzr selftest` so this pokes around the subunit module to see if the new implementation is in place before running the check.

To post a comment you must log in.
Revision history for this message
Vincent Ladeuil (vila) wrote :

Hmm, should we file a bug to make sure we remove that once we require a released version of subunit with the fix ?

Half-serious.

review: Approve
Revision history for this message
Martin Packman (gz) wrote :

Bug 531667 exists for having a version attribute in the subunit python module that we'd need in order to require a minimum subunit version.

Revision history for this message
Vincent Ladeuil (vila) wrote :

> Bug 531667 exists for having a version attribute in the subunit python module
> that we'd need in order to require a minimum subunit version.

Hehe, isn't it lovely when pieces naturally fell in the right place ;)

Should I upgrade my vote to tweak so you mention the bug # in the comment ? ;)

Revision history for this message
Andrew Bennetts (spiv) wrote :

sent to pqm by email

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'bzrlib/tests/test_selftest.py'
2--- bzrlib/tests/test_selftest.py 2011-05-16 17:20:43 +0000
3+++ bzrlib/tests/test_selftest.py 2011-05-18 19:58:29 +0000
4@@ -2195,9 +2195,13 @@
5 content, result = self.run_subunit_stream('test_unexpected_success')
6 self.assertContainsRe(content, '(?m)^log$')
7 self.assertContainsRe(content, 'test with unexpected success')
8- self.expectFailure('subunit treats "unexpectedSuccess"'
9- ' as a plain success',
10- self.assertEqual, 1, len(result.unexpectedSuccesses))
11+ # GZ 2011-05-18: Old versions of subunit treat unexpected success as a
12+ # success, if a min version check is added remove this
13+ from subunit import TestProtocolClient as _Client
14+ if _Client.addUnexpectedSuccess.im_func is _Client.addSuccess.im_func:
15+ self.expectFailure('subunit treats "unexpectedSuccess"'
16+ ' as a plain success',
17+ self.assertEqual, 1, len(result.unexpectedSuccesses))
18 self.assertEqual(1, len(result.unexpectedSuccesses))
19 test = result.unexpectedSuccesses[0]
20 # RemotedTestCase doesn't preserve the "details"