Michael Foord added the comment:

On 19 Sep 2013, at 14:06, Antoine Pitrou <rep...@bugs.python.org> wrote:

> 
> Antoine Pitrou added the comment:
> 
>> That would only be a shallow copy, so I'm not sure it's worth the
>> effort. The test has the opportunity in the setUp to ensure that
>> initial state is correct - so I would leave that per test.
> 
> I don't understand your objection. The concern is to get rid of old
> state after test execution.
> 

If the object state includes mutable objects then restoring the previous 
dictionary will just restore the same mutable (and likely mutated) object. To 
*properly* restore state you'd either need to deepcopy the dictionary or 
reinstantiate the testcase (not reuse it in other words). I'd rather leave it 
up to each test to ensure it reinitialises attributes in setUp than add further 
complexity that only does part of the job.

>> Obviously
>> sharing state between tests is prima facie bad, but any framework
>> reusing test suites is doing that already.
> 
> What do you mean?

Any framework that is currently reusing test suites is re-using testcase 
instances. They are already sharing state between the runs.

In fact messing with testcase dictionaries is a further possible cause of 
backwards incompatibility for those suites. 

> 
> ----------
> 
> _______________________________________
> Python tracker <rep...@bugs.python.org>
> <http://bugs.python.org/issue11798>
> _______________________________________

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue11798>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to