summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_tempfile.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/test/test_tempfile.py')
-rw-r--r--Lib/test/test_tempfile.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/Lib/test/test_tempfile.py b/Lib/test/test_tempfile.py
index 8df3856..d88d50f 100644
--- a/Lib/test/test_tempfile.py
+++ b/Lib/test/test_tempfile.py
@@ -49,7 +49,8 @@ class TC(unittest.TestCase):
npre = nbase[:len(pre)]
nsuf = nbase[len(nbase)-len(suf):]
- self.assertEqual(ndir, dir,
+ # check for equality of the absolute paths!
+ self.assertEqual(os.path.abspath(ndir), os.path.abspath(dir),
"file '%s' not in directory '%s'" % (name, dir))
self.assertEqual(npre, pre,
"file '%s' does not begin with '%s'" % (nbase, pre))
@@ -384,6 +385,10 @@ class test_mkstemp(TC):
dir = tempfile.gettempdir()
try:
(fd, name) = tempfile.mkstemp(dir=dir, prefix=pre, suffix=suf)
+ (ndir, nbase) = os.path.split(name)
+ adir = os.path.abspath(dir)
+ self.assertEqual(adir, ndir,
+ "Directory '%s' incorrectly returned as '%s'" % (adir, ndir))
except:
self.failOnException("mkstemp")
@@ -400,6 +405,7 @@ class test_mkstemp(TC):
self.do_create(suf="b")
self.do_create(pre="a", suf="b")
self.do_create(pre="aa", suf=".txt")
+ self.do_create(dir=".")
def test_choose_directory(self):
# mkstemp can create directories in a user-selected directory