Merge lp:~jml/testtools/assert-raises-lambda into lp:~testtools-committers/testtools/trunk
| Status: | Merged | ||||
|---|---|---|---|---|---|
| Merged at revision: | 240 | ||||
| Proposed branch: | lp:~jml/testtools/assert-raises-lambda | ||||
| Merge into: | lp:~testtools-committers/testtools/trunk | ||||
| Diff against target: |
171 lines (+93/-2) 4 files modified
NEWS (+6/-0) doc/for-test-authors.rst (+21/-0) testtools/testcase.py (+21/-2) testtools/tests/test_testcase.py (+45/-0) |
||||
| To merge this branch: | bzr merge lp:~jml/testtools/assert-raises-lambda | ||||
| Related bugs: |
|
| Reviewer | Review Type | Date Requested | Status |
|---|---|---|---|
| Robert Collins | 2012-01-28 | Approve on 2012-01-28 | |
|
Review via email:
|
|||
Description of the Change
When assertRaises currently fails, it doesn't mention the callable that it was invoked with. Instead it mentions a lambda that we make up in order to be able to re-use the Raises matcher.
This patch addresses this problem by using a wrapper object instead of a lambda. The wrapper object is a nullary callable and has a custom __repr__ method that forwards to the callable that assertRaises was invoked with.
- 239. By Jonathan Lange on 2012-01-28
-
NEWS update
- 240. By Jonathan Lange on 2012-01-28
-
Format properly
| Jonathan Lange (jml) wrote : | # |
| Robert Collins (lifeless) wrote : | # |
This will certainly work. Its a bit sad that folk using lambda's directly won't get the benefit. Perhaps the wrapper should be a public helper? [short of introspecting lambdas...
- 241. By Jonathan Lange on 2012-01-29
-
Extract Nullary and move it into helpers.
- 242. By Jonathan Lange on 2012-01-29
-
Move to testcase so it doesn't appear in stack traces.
- 243. By Jonathan Lange on 2012-01-29
-
In the NEWS
- 244. By Jonathan Lange on 2012-01-29
-
Document

Note that this is the sort of thing that's likely to trip up with cross-Python compatibility – I've only tested on Python 2.7.
We need to make sure that trunk passes on all supported Pythons before releasing.