Merge lp:~spiv/bzr/traceback-accumulation-2.2 into lp:bzr/2.2
Status: | Merged |
---|---|
Approved by: | Andrew Bennetts |
Approved revision: | no longer in the source branch. |
Merged at revision: | 5090 |
Proposed branch: | lp:~spiv/bzr/traceback-accumulation-2.2 |
Merge into: | lp:bzr/2.2 |
Diff against target: |
126 lines (+64/-6) 3 files modified
NEWS (+3/-3) bzrlib/tests/__init__.py (+26/-2) bzrlib/tests/test_selftest.py (+35/-1) |
To merge this branch: | bzr merge lp:~spiv/bzr/traceback-accumulation-2.2 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
bzr-core | Pending | ||
Review via email: mp+35494@code.launchpad.net |
Commit message
More robust fix for TestCase cloning, this time with tests.
Description of the change
Robert pointed out that my simple TestCase.__copy__ would break tests that were created by repeated application of apply_scenarios. I don't think there are any cases of this in bzr's own test suite (we use multiply_scenarios instead, so there's still just one application of a scenario list to a series of tests), but it could break plugins and invites trouble.
So this patch implements __copy__ as:
* shallow copy the instance __dict__
* deep copy individual attributes on a hard-coded blacklist
* create a new instance (skipping __init__) and give it the new __dict__
In addition, this adds two new tests to test_selftest to catch both the original problem and Robert's concern. I feel compelled to point out that if such tests had existed in the first place we wouldn't have this problem now ;)
Finally, this tweaks the relevant NEWS entry.
I think this is really rather in the wrong place - testtools is the source of the bug.