[issue26878] Allow doctest to deep copy globals

2016-04-29 Thread DqASe
DqASe added the comment: I see your point. I thought it can still be useful in these scenarios: 1. when doc/testing tens of methods of a specific class. Instantiation of the class is repetitive (DRY principle). 2. Instantiation can be expensive (e.g. from network) 3. To behave less

[issue26878] Allow doctest to deep copy globals

2016-04-29 Thread DqASe
DqASe added the comment: I'd like each test to see the same environment (including variables contents). Deepcopying extraglobs argument at call time is not sufficient because it is only done once, not before each test. -- Added file: http://bugs.python.org/file42649

[issue26878] Allow doctest to deep copy globals

2016-04-28 Thread DqASe
DqASe added the comment: Alternatively, add an option like deepglobs={...} . The dictionary argument would be deep-copied at each test and added to the environment. -- ___ Python tracker <http://bugs.python.org/issue26

[issue26878] Allow doctest to deep copy globals

2016-04-28 Thread DqASe
Changes by DqASe : -- components: +Tests -Library (Lib) ___ Python tracker <http://bugs.python.org/issue26878> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue26878] Allow doctest to deep copy globals

2016-04-28 Thread DqASe
New submission from DqASe: Currently doctest makes shallow copies of the environment or globs argument. This is somewhat un-symmetrical: on the one hand, a test cannot see variables created by another, but on the other, it can alter mutable objects. This is inconvenient e.g. when