Author michael.foord
Recipients asvetlov, benjamin.peterson, charettes, ezio.melotti, fabioz, gvanrossum, matthewlmcclure, matthewlmcclure-gmail, meador.inge, michael.foord, pitrou, python-dev, r.david.murray, rhettinger, terry.reedy, tim.peters, tomwardill
Date 2013-09-19.13:13:47
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <4118697B-204A-402F-AF22-80EDF60F9594@voidspace.org.uk>
In-reply-to <384150135.4076465.1379596004302.JavaMail.root@zimbra10-e2.priv.proxad.net>
Content
On 19 Sep 2013, at 14:06, Antoine Pitrou <report@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 <report@bugs.python.org>
> <http://bugs.python.org/issue11798>
> _______________________________________
History
Date User Action Args
2013-09-19 13:13:47michael.foordsetrecipients: + michael.foord, gvanrossum, tim.peters, rhettinger, terry.reedy, pitrou, fabioz, benjamin.peterson, ezio.melotti, r.david.murray, matthewlmcclure, asvetlov, meador.inge, python-dev, tomwardill, matthewlmcclure-gmail, charettes
2013-09-19 13:13:47michael.foordlinkissue11798 messages
2013-09-19 13:13:47michael.foordcreate