[Python-checkins] python/dist/src/Lib/test test_tempfile.py, 1.14, 1.15

loewis at users.sourceforge.net loewis at users.sourceforge.net
Sun Oct 12 13:37:03 EDT 2003


Update of /cvsroot/python/python/dist/src/Lib/test
In directory sc8-pr-cvs1:/tmp/cvs-serv17091/Lib/test

Modified Files:
	test_tempfile.py 
Log Message:
Patch #810914: Return absolute path for mkstemp. Fixes #810408.
This should not be backported to 2.3, as it might break backwards
compatibility.


Index: test_tempfile.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_tempfile.py,v
retrieving revision 1.14
retrieving revision 1.15
diff -C2 -d -r1.14 -r1.15
*** test_tempfile.py	1 May 2003 17:45:51 -0000	1.14
--- test_tempfile.py	12 Oct 2003 17:37:01 -0000	1.15
***************
*** 50,54 ****
          nsuf  = nbase[len(nbase)-len(suf):]
  
!         self.assertEqual(ndir, dir,
                           "file '%s' not in directory '%s'" % (name, dir))
          self.assertEqual(npre, pre,
--- 50,55 ----
          nsuf  = nbase[len(nbase)-len(suf):]
  
!         # 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,
***************
*** 385,388 ****
--- 386,393 ----
          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")
***************
*** 401,404 ****
--- 406,410 ----
          self.do_create(pre="a", suf="b")
          self.do_create(pre="aa", suf=".txt")
+         self.do_create(dir=".")
  
      def test_choose_directory(self):





More information about the Python-checkins mailing list