Michał Górny committed 60aee0f

Use mkdtemp() to obtain unique parent temporary directory.

This fixes parallel runs, allowing to obtain multiple temporary directories
with the same 'basename'.

Comments (0)

Files changed (1)


                  suppress=frozenset(), keepdir=False):
         assert basename != "basename"
         self.basename = basename or hex(random.randint(0, 1000000000))[2:]
-        parentdir = parentdir or tempfile.gettempdir()
+        parentdir = parentdir or tempfile.mkdtemp()
         dirname = os.path.join(parentdir, self.basename + ext)
         self.parentdir = parentdir
         self.dir = os.path.abspath(dirname)