[issue26878] Allow doctest to deep copy globals

DqASe report at bugs.python.org
Fri Apr 29 08:18:39 EDT 2016


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-surprisingly (why can't I re-use objects created in an earlier test, but I can re-use the internal state of mutable ones?)
4. An aspiration for tests to be forcibly sandboxed from the execution environment (that would require deep copies by default).
5. Relying on an always-equal global state is better (IMHO) than relying on a *mutable* global state, after all.

But I understand it's debatable. Thanks anyways.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue26878>
_______________________________________


More information about the Python-bugs-list mailing list