From 68f203f0d5d5c109fad0ac2432390837260c60da Mon Sep 17 00:00:00 2001
From: Paul McCarthy <pauldmccarthy@gmail.com>
Date: Mon, 27 Nov 2023 11:46:05 +0000
Subject: [PATCH] TEST: Test tempdir prefix option

---
 fsl/tests/test_tempdir.py | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/fsl/tests/test_tempdir.py b/fsl/tests/test_tempdir.py
index 80d1e72b4..d3238ba49 100644
--- a/fsl/tests/test_tempdir.py
+++ b/fsl/tests/test_tempdir.py
@@ -6,6 +6,7 @@
 #
 
 
+import glob
 import os
 import os.path as op
 
@@ -53,6 +54,15 @@ def test_tempdir_changeto():
     assert op.realpath(os.getcwd()) == cwd
 
 
+def test_tempdir_prefix():
+    with tempdir.tempdir(prefix='mytempdirtest') as tdir:
+        assert op.basename(tdir).startswith('mytempdirtest')
+
+    with tempdir.tempdir() as parent:
+        with tempdir.tempdir(prefix='mytempdirtest', root='.') as tdir:
+            assert list(glob.glob(op.join(parent, 'mytempdirtest*'))) == [tdir]
+
+
 def test_tempdir_override():
     with tempdir.tempdir() as parent:
         override = op.abspath((op.join('override', 'directory')))
-- 
GitLab