use tempdir.mkdtmp instead of mktmp + repeated tries for making tmpdirs
--HG-- branch : trunk
This commit is contained in:
parent
a07e494554
commit
2e82ca5fde
|
@ -633,16 +633,7 @@ class LocalPath(FSBase):
|
||||||
(which we created ourself).
|
(which we created ourself).
|
||||||
"""
|
"""
|
||||||
import tempfile
|
import tempfile
|
||||||
tries = 10
|
return cls(py.error.checked_call(tempfile.mkdtemp))
|
||||||
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)
|
|
||||||
mkdtemp = classmethod(mkdtemp)
|
mkdtemp = classmethod(mkdtemp)
|
||||||
|
|
||||||
def make_numbered_dir(cls, prefix='session-', rootdir=None, keep=3,
|
def make_numbered_dir(cls, prefix='session-', rootdir=None, keep=3,
|
||||||
|
|
Loading…
Reference in New Issue