change deepcopy to copy
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
testtools |
Fix Released
|
Medium
|
Robert Collins |
Bug Description
using testresources with testscenarios will prevent optimisation of test suites due to resources being deepcopied rather than referenced.
I think we should switch to shallow copying, by default, allowing folk to implement __deepcopy__ if they have a need for that.
My rationale:
- our tests, and test API encourages setUp to be used to add state, not __init__; the few things we encourage using __init__ for take regular functions or attribute names, not bound methods.
- deep copy is surprising and actually quite buggy: 2.4 cannot deep copy functions or method instances; only 2.7 and above can copy method instances. When converting bzrlib to use testtools as a base, I experimented with deepcopy, and it broke lots of things.
I argue that this is a defect in our current clone support, so making it medium.
Related branches
- Jonathan Lange: Approve
-
Diff: 41 lines (+14/-5)2 files modifiedNEWS (+4/-0)
testtools/testcase.py (+10/-5)
Changed in testtools: | |
status: | Triaged → Fix Released |
assignee: | nobody → Robert Collins (lifeless) |
milestone: | none → next |