summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_tempfile.py
diff options
context:
space:
mode:
authorTim Golden <mail@timgolden.me.uk>2013-10-25 17:38:16 (GMT)
committerTim Golden <mail@timgolden.me.uk>2013-10-25 17:38:16 (GMT)
commit6d09f09d8b4f6e45f4b96145bc75500f590de834 (patch)
treea3389f4a5e6c869977fc9e62d6c48575e8a6d027 /Lib/test/test_tempfile.py
parent8fea252a507024edf00d5d98881d22dc8799a8d3 (diff)
downloadcpython-6d09f09d8b4f6e45f4b96145bc75500f590de834.zip
cpython-6d09f09d8b4f6e45f4b96145bc75500f590de834.tar.gz
cpython-6d09f09d8b4f6e45f4b96145bc75500f590de834.tar.bz2
Issue14255 Don't flatten case of tempdir
Diffstat (limited to 'Lib/test/test_tempfile.py')
-rw-r--r--Lib/test/test_tempfile.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/Lib/test/test_tempfile.py b/Lib/test/test_tempfile.py
index 1ee36e2..ac4d860 100644
--- a/Lib/test/test_tempfile.py
+++ b/Lib/test/test_tempfile.py
@@ -478,6 +478,20 @@ class TestGetTempDir(BaseTestCase):
self.assertTrue(a is b)
+ def test_case_sensitive(self):
+ # gettempdir should not flatten its case
+ # even on a case-insensitive file system
+ case_sensitive_tempdir = tempfile.mkdtemp("-Temp")
+ _tempdir, tempfile.tempdir = tempfile.tempdir, None
+ try:
+ with support.EnvironmentVarGuard() as env:
+ # Fake the first env var which is checked as a candidate
+ env["TMPDIR"] = case_sensitive_tempdir
+ self.assertEqual(tempfile.gettempdir(), case_sensitive_tempdir)
+ finally:
+ tempfile.tempdir = _tempdir
+ support.rmdir(case_sensitive_tempdir)
+
class TestMkstemp(BaseTestCase):
"""Test mkstemp()."""