Merge lp:~jml/testtools/unexpected-success-2 into lp:~testtools-committers/testtools/trunk
| Status: | Merged | ||||
|---|---|---|---|---|---|
| Merged at revision: | 142 | ||||
| Proposed branch: | lp:~jml/testtools/unexpected-success-2 | ||||
| Merge into: | lp:~testtools-committers/testtools/trunk | ||||
| Diff against target: |
570 lines (+233/-38) 5 files modified
NEWS (+6/-1) testtools/testresult/doubles.py (+17/-1) testtools/testresult/real.py (+38/-3) testtools/tests/test_compat.py (+8/-7) testtools/tests/test_testresult.py (+164/-26) |
||||
| To merge this branch: | bzr merge lp:~jml/testtools/unexpected-success-2 | ||||
| Related bugs: |
|
| Reviewer | Review Type | Date Requested | Status |
|---|---|---|---|
| Martin Packman | Needs Fixing on 2010-11-28 | ||
| Robert Collins | 2010-11-28 | Approve on 2010-11-28 | |
|
Review via email:
|
|||
Description of the Change
This branch finished off the rest of bug 654474. It changes the contract of TestResult such that wasSuccessful returns False if there has ever been an unexpected success.
In addition, it updates the contract tests to test for the behaviour of wasSuccessful in many more cases, and adds contract tests for Python 2.6 and 2.7 which we run against our fake implementations.
- 145. By Jonathan Lange on 2010-11-28
-
Update NEWS
| Jonathan Lange (jml) wrote : | # |
Agreed on both points. Will only update startTestRun for testtools
TestResult, since I'm not controlling Python.
Would be better with testscenarios, but not in this branch. Also, we need
to have a chat about dependencies.
Thanks,
jml
| Martin Packman (gz) wrote : | # |
On Python 3 (with lp:~gz/testtools/raises_regressions_675327 merged) I get three failures. All in TestMultiTestre
There are actually four failures, but one is silent...
As noted by Martin Pool in bug 654474 comment 5 changing the outcome without also providing feedback is bad, so I think TextTestResult.
=== modified file 'testtools/
--- testtools/
+++ testtools/
@@ -258,6 +261,8 @@
stop = self._now()
+ for test in self.unexpected
+ self.stream.
@@ -267,7 +272,7 @@
- len(self.failures) + len(self.errors)))
+ len(self.failures) + len(self.errors) + len(self.
The silent failure that should then be revealed on Python 3 also needs fixing:
=== modified file 'testtools/
--- testtools/
+++ testtools/
@@ -19,6 +19,7 @@
)
from testtools.matchers import (
MatchesExc
+ Not,
Raises,
)
@@ -246,7 +247,7 @@
if newio:
- Raises(
+ Not(Raises(
Final nit:
+ def test_addUnexpec
+ # addUnexpectedSu
Verb?
| Jonathan Lange (jml) wrote : | # |
mgz, thanks very much for the review. I've fixed the nits, TextTestResult, the MultiTestResult failure (map(f, xs) returns an iterator in Python 3) and the hidden failure in test_compat. I also added tests for the TextTestResult changes.
lifeless, I've made the startTestRun change.
I'm going to merge it now, but I'd welcome any comments you have on the incremental diff.
- 146. By Jonathan Lange on 2010-11-28
-
minor nits
- 147. By Jonathan Lange on 2010-11-29
-
Make MultiTestResult at all usable in Python 3
- 148. By Jonathan Lange on 2010-11-29
-
startTestRun resets unexpected successes and other errors
- 149. By Jonathan Lange on 2010-11-29
-
NEWS update
- 150. By Jonathan Lange on 2010-11-29
-
Actually report the error in TextTestResult (thanks mgz)
- 151. By Jonathan Lange on 2010-11-29
-
Fix a inaccurate unexpected success, hidden by our broken Python 3 support
| Robert Collins (lifeless) wrote : | # |
+ len(self.failures) + len(self.errors)))
+ len(self.failures) + len(self.errors)
+ + len(self.
sum(map(len, (self, self.failures, self.errors,
self.
Would be cleaner, I think?

Seems to me that wasSuccessful() should be reset by startTestRun - what do you think?
Rather than a mixin, this looks like a job for testscenarios. Its fine without but clearly not as nice.