GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing mail.python.org — [Python-Dev] Committing bsddb 4.6.4, and where can I put testsuite temp files? [Python-Dev] Committing bsddb 4.6.4, and where can I put testsuite temp files?Nick Coghlan ncoghlan at gmail.comWed May 14 06:37:47 CEST 2008
Brett Cannon wrote: > On Tue, May 13, 2008 at 12:41 PM, Jesus Cea <jcea at jcea.es> wrote: >> -----BEGIN PGP SIGNED MESSAGE----- >> Hash: SHA1 >> >> Brett Cannon wrote: >> | It is up to the tests to clean up after themselves since they can be >> | executed directly, so there is not magical location that gets cleaned >> | up in case a test screws up. You can use test.test_support.TESTFN if >> | you want a location. Or something from tempfile. >> >> I'm worried about the case when a test crashes and leave garbage >> behind... that will crash future test runs. >> > > Then don't crash on tests. =) > >> I guess I would delete the directory before using it, but I guess >> somebody already had this problem and solved it, somehow. :-? > > That's usually the other way to go about it. In your test_main() or > your setUp() methods you make sure everything is clean before you > start. Personally, I use the tempfile module to get a temporary directory and do anything I need in there (see test_runpy.py or test_cmdline_script.py for examples). That way, even if the test does manage to crash in a way that bypasses the shutil.rmtree cleanup call (which is actually fairly hard to do when the cleanup call is in a finally clause or a tearDown method), it won't affect subsequent executions (although it may accumulate clutter in the buildbot machine's temporary directories over time). Cheers, Nick. -- Nick Coghlan | ncoghlan at gmail.com | Brisbane, Australia --------------------------------------------------------------- http://www.boredomandlaziness.org
More information about the Python-Dev mailing list |
| You are visitor 01402520 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |