Don't delete the tempdir if it's passed in from the runner

This commit is contained in:
wiredfool 2014-04-17 10:05:07 -07:00
parent 7ecda007e0
commit 955bfd47de

View File

@ -22,8 +22,10 @@ _target = None
_tempfiles = [] _tempfiles = []
if 'pillow-tests' in sys.argv[-1] and os.path.exists(sys.argv[-1]): if 'pillow-tests' in sys.argv[-1] and os.path.exists(sys.argv[-1]):
_temproot = sys.argv[-1] _temproot = sys.argv[-1]
_rmtempdir = False
else: else:
_temproot = tempfile.mkdtemp(prefix='pillow-tests') _temproot = tempfile.mkdtemp(prefix='pillow-tests')
_rmtempdir = True
_logfile = None _logfile = None
@ -320,6 +322,7 @@ def _setup():
os.remove(file) os.remove(file)
except OSError: except OSError:
pass # report? pass # report?
if _rmtempdir:
try: try:
os.rmdir(_temproot) os.rmdir(_temproot)
except OSError: except OSError: