use tempdir.mkdtmp instead of mktmp + repeated tries for making tmpdirs

--HG--
branch : trunk
This commit is contained in:
Ronny Pfannschmidt 2010-06-03 10:59:24 +02:00
parent a07e494554
commit 2e82ca5fde
1 changed files with 1 additions and 10 deletions

View File

@ -633,16 +633,7 @@ class LocalPath(FSBase):
(which we created ourself).
"""
import tempfile
tries = 10
for i in range(tries):
dname = tempfile.mktemp()
dpath = cls(tempfile.mktemp())
try:
dpath.mkdir()
except (py.error.EEXIST, py.error.EPERM, py.error.EACCES):
continue
return dpath
raise py.error.ENOENT(dpath, "could not create tempdir, %d tries" % tries)
return cls(py.error.checked_call(tempfile.mkdtemp))
mkdtemp = classmethod(mkdtemp)
def make_numbered_dir(cls, prefix='session-', rootdir=None, keep=3,