summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_tempfile.py
diff options
context:
space:
mode:
authorSamuel Sloniker <sam@kj7rrv.com>2023-04-25 16:05:59 (GMT)
committerGitHub <noreply@github.com>2023-04-25 16:05:59 (GMT)
commit32bea69b89e32a8c673db3315e1ea3de48ea7702 (patch)
tree6dfc98400b736b23c0f809794e017589fce5c5f9 /Lib/test/test_tempfile.py
parentc8c3956d905e019101038b018129a4c90c9c9b8f (diff)
downloadcpython-32bea69b89e32a8c673db3315e1ea3de48ea7702.zip
cpython-32bea69b89e32a8c673db3315e1ea3de48ea7702.tar.gz
cpython-32bea69b89e32a8c673db3315e1ea3de48ea7702.tar.bz2
gh-51574: Make tempfile.mkdtemp() always return absolute paths (#94612)
Co-authored-by: Éric <merwok@netwok.org> Co-authored-by: AlexWaygood <alex.waygood@gmail.com>
Diffstat (limited to 'Lib/test/test_tempfile.py')
-rw-r--r--Lib/test/test_tempfile.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/Lib/test/test_tempfile.py b/Lib/test/test_tempfile.py
index 11a43ac..db08fb1 100644
--- a/Lib/test/test_tempfile.py
+++ b/Lib/test/test_tempfile.py
@@ -850,6 +850,15 @@ class TestMkdtemp(TestBadTempdir, BaseTestCase):
finally:
tempfile.tempdir = orig_tempdir
+ def test_path_is_absolute(self):
+ # Test that the path returned by mkdtemp with a relative `dir`
+ # argument is absolute
+ try:
+ path = tempfile.mkdtemp(dir=".")
+ self.assertTrue(os.path.isabs(path))
+ finally:
+ os.rmdir(path)
+
class TestMktemp(BaseTestCase):
"""Test mktemp()."""