Skip to content

Commit 2e703d3

Browse files
committed
Use dir not prefix for mkdtemp
1 parent 2b53995 commit 2e703d3

File tree

4 files changed

+13
-13
lines changed

4 files changed

+13
-13
lines changed

easybuild/toolchains/mpi/openmpi.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ def prepare(self, *args, **kwargs):
8181
ompi_ver = self.get_software_version(self.MPI_MODULE_NAME)[0]
8282
if LooseVersion(ompi_ver) >= LooseVersion('2.0') and LooseVersion(ompi_ver) < LooseVersion('3.0'):
8383
if len(self.orig_tmpdir) > 40:
84-
tmpdir = tempfile.mkdtemp(prefix='/tmp/')
84+
tmpdir = tempfile.mkdtemp(dir='/tmp/')
8585
env.setvar('TMPDIR', tmpdir)
8686
warn_msg = "Long $TMPDIR path may cause problems with OpenMPI 2.x, using shorter path: %s" % tmpdir
8787
self.log.warning(warn_msg)

test/framework/easyconfig.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2211,7 +2211,7 @@ def test_dump_extra(self):
22112211
'',
22122212
])
22132213

2214-
handle, testec = tempfile.mkstemp(prefix=self.test_prefix, suffix='.eb')
2214+
handle, testec = tempfile.mkstemp(suffix='.eb')
22152215
os.close(handle)
22162216

22172217
ec = EasyConfig(None, rawtxt=rawtxt)
@@ -2274,7 +2274,7 @@ def test_dump_template(self):
22742274
'moduleclass = "tools"',
22752275
])
22762276

2277-
handle, testec = tempfile.mkstemp(prefix=self.test_prefix, suffix='.eb')
2277+
handle, testec = tempfile.mkstemp(suffix='.eb')
22782278
os.close(handle)
22792279

22802280
ec = EasyConfig(None, rawtxt=rawtxt)
@@ -2350,7 +2350,7 @@ def test_dump_comments(self):
23502350
"# trailing comment",
23512351
])
23522352

2353-
handle, testec = tempfile.mkstemp(prefix=self.test_prefix, suffix='.eb')
2353+
handle, testec = tempfile.mkstemp(suffix='.eb')
23542354
os.close(handle)
23552355

23562356
ec = EasyConfig(None, rawtxt=rawtxt)

test/framework/modules.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -588,7 +588,7 @@ def broken_prepend_module_path(*args, **kwargs):
588588

589589
def test_prepend_module_path(self):
590590
"""Test prepend_module_path method."""
591-
test_path = tempfile.mkdtemp(prefix=self.test_prefix)
591+
test_path = tempfile.mkdtemp()
592592
self.modtool.prepend_module_path(test_path)
593593
self.assertTrue(os.path.samefile(curr_module_paths()[0], test_path))
594594

@@ -611,17 +611,17 @@ def test_prepend_module_path(self):
611611
self.assertEqual(modulepath, curr_module_paths())
612612

613613
# test prepending with high priority
614-
test_path_bis = tempfile.mkdtemp(prefix=self.test_prefix)
615-
test_path_tris = tempfile.mkdtemp(prefix=self.test_prefix)
616-
self.modtool.prepend_module_path(test_path_bis, priority=10000)
617-
self.assertEqual(test_path_bis, curr_module_paths()[0])
614+
test_path_0 = tempfile.mkdtemp(suffix='path_0')
615+
test_path_1 = tempfile.mkdtemp(suffix='path_1')
616+
self.modtool.prepend_module_path(test_path_0, priority=1000)
617+
self.assertEqual(test_path_0, curr_module_paths()[0])
618618

619619
# check whether prepend with priority actually works (only for Lmod)
620620
if isinstance(self.modtool, Lmod):
621-
self.modtool.prepend_module_path(test_path_tris)
621+
self.modtool.prepend_module_path(test_path_1)
622622
modulepath = curr_module_paths()
623-
self.assertEqual(test_path_bis, modulepath[0])
624-
self.assertEqual(test_path_tris, modulepath[1])
623+
self.assertEqual(test_path_0, modulepath[0])
624+
self.assertEqual(test_path_1, modulepath[1])
625625

626626
def test_ld_library_path(self):
627627
"""Make sure LD_LIBRARY_PATH is what it should be when loaded multiple modules."""

test/framework/toolchain.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2376,7 +2376,7 @@ def prep():
23762376
orig_tmpdir = os.environ.get('TMPDIR')
23772377
if len(orig_tmpdir) > 40:
23782378
# we need to make sure we have a short $TMPDIR for this test...
2379-
orig_tmpdir = tempfile.mkdtemp(prefix='/tmp/')
2379+
orig_tmpdir = tempfile.mkdtemp(dir='/tmp/')
23802380
mkdir(orig_tmpdir)
23812381
os.environ['TMPDIR'] = orig_tmpdir
23822382

0 commit comments

Comments
 (0)