[Python-checkins] r65317 - doctools/branches/0.4.x/tests/util.py

benjamin.peterson python-checkins at python.org
Thu Jul 31 01:31:29 CEST 2008


Author: benjamin.peterson
Date: Thu Jul 31 01:31:29 2008
New Revision: 65317
Log:
make TestApp.cleanup more aggressive
Modified:
 doctools/branches/0.4.x/tests/util.py
Modified: doctools/branches/0.4.x/tests/util.py
==============================================================================
--- doctools/branches/0.4.x/tests/util.py	(original)
+++ doctools/branches/0.4.x/tests/util.py	Thu Jul 31 01:31:29 2008
@@ -92,13 +92,18 @@
 srcdir = test_root
 else:
 srcdir = path(srcdir)
+ self.builddir = srcdir.joinpath('_build')
+ if not self.builddir.isdir():
+ os.makedirs(self.builddir)
+ self.made_builddir = True
+ else:
+ self.made_builddir = False
 if confdir is None:
 confdir = srcdir
 if outdir is None:
- outdir = srcdir.joinpath('_build', buildername)
- os.makedirs(outdir)
+ outdir = srcdir.joinpath(self.builddir, buildername)
 if doctreedir is None:
- doctreedir = srcdir.joinpath(srcdir, '_build', 'doctrees')
+ doctreedir = srcdir.joinpath(srcdir, self.builddir, 'doctrees')
 if confoverrides is None:
 confoverrides = {}
 if status is None:
@@ -113,9 +118,11 @@
 freshenv)
 
 def cleanup(self):
- try:
- shutil.rmtree(self.outdir)
- except IOError: pass
+ trees = [self.outdir, self.doctreedir]
+ if self.made_builddir:
+ trees.append(self.builddir)
+ for tree in trees:
+ shutil.rmtree(tree, True)
 
 
 def with_testapp(*args, **kwargs):


More information about the Python-checkins mailing list

AltStyle によって変換されたページ (->オリジナル) /