On 07/04/2011 17:18, Fabio Zadrozny wrote: > I actually created a bug entry for this > (http://bugs.python.org/issue11798) and just later it occurred that I > should've asked in the list first :) > > So, here's the text for opinions: > > Right now, when doing a test case, one must clear all the variables > created in the test class, and I believe this shouldn't be needed... > > E.g.: > > class Test(TestCase): > def setUp(self): > self.obj1 = MyObject() > > ... > > def tearDown(self): > del self.obj1 > > Ideally (in my view), right after running the test, it should be > garbage-collected and the explicit tearDown just for deleting the > object wouldn't be needed (as the test would be garbage-collected, > that reference would automatically die), because this is currently > very error prone... (and probably a source of leaks for any > sufficiently big test suite). > > If that's accepted, I can provide a patch. You mean that the test run keeps the test instances alive for the whole test run so instance attributes are also kept alive. How would you solve this - by having calling a TestSuite (which is how a test run is executed) remove members from themselves after each test execution? (Any failure tracebacks etc stored by the TestResult would also have to not keep the test alive.) My only concern would be backwards compatibility due to the change in behaviour. All the best, Michael Foord > Thanks, > > Fabio > _______________________________________________ > Python-Dev mailing list > Python-Dev at python.org > http://mail.python.org/mailman/listinfo/python-dev > Unsubscribe: http://mail.python.org/mailman/options/python-dev/fuzzyman%40voidspace.org.uk -- http://www.voidspace.org.uk/ May you do good and not evil May you find forgiveness for yourself and forgive others May you share freely, never taking more than you give. -- the sqlite blessing http://www.sqlite.org/different.html
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4