summaryrefslogtreecommitdiff
path: root/lib/spack/spack/test/llnl/util/filesystem.py
diff options
context:
space:
mode:
Diffstat (limited to 'lib/spack/spack/test/llnl/util/filesystem.py')
-rw-r--r--lib/spack/spack/test/llnl/util/filesystem.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/spack/spack/test/llnl/util/filesystem.py b/lib/spack/spack/test/llnl/util/filesystem.py
index 0db8e93ae8..39b81d574f 100644
--- a/lib/spack/spack/test/llnl/util/filesystem.py
+++ b/lib/spack/spack/test/llnl/util/filesystem.py
@@ -610,3 +610,10 @@ def test_keep_modification_time(tmpdir):
assert file1.read().strip() == 'file1'
assert not file2.exists()
assert int(mtime1) == int(file1.mtime())
+
+
+def test_temporary_dir_context_manager():
+ previous_dir = os.path.realpath(os.getcwd())
+ with fs.temporary_dir() as tmp_dir:
+ assert previous_dir != os.path.realpath(os.getcwd())
+ assert os.path.realpath(str(tmp_dir)) == os.path.realpath(os.getcwd())