Message198068
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>
> _______________________________________ |
|
Date |
User |
Action |
Args |
2013-09-19 13:13:47 | michael.foord | set | recipients:
+ 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:47 | michael.foord | link | issue11798 messages |
2013-09-19 13:13:47 | michael.foord | create | |
|