[Python-checkins] python/dist/src/Lib/test test_posixpath.py, 1.12, 1.13

birkenfeld@users.sourceforge.net birkenfeld at users.sourceforge.net
Fri Jun 3 16:24:56 CEST 2005


Update of /cvsroot/python/python/dist/src/Lib/test
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5595/Lib/test

Modified Files:
	test_posixpath.py 
Log Message:
Bug #1213894: os.path.realpath didn't resolve symlinks that were the first
component of the path.



Index: test_posixpath.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_posixpath.py,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- test_posixpath.py	30 Aug 2004 10:19:56 -0000	1.12
+++ test_posixpath.py	3 Jun 2005 14:24:44 -0000	1.13
@@ -476,6 +476,26 @@
                 self.safe_rmdir(ABSTFN + "/k/y")
                 self.safe_rmdir(ABSTFN + "/k")
                 self.safe_rmdir(ABSTFN)
+        
+        def test_realpath_resolve_first(self):
+            # Bug #1213894: The first component of the path, if not absolute,
+            # must be resolved too.
+
+            try:
+                old_path = abspath('.')
+                os.mkdir(ABSTFN)
+                os.mkdir(ABSTFN + "/k")
+                os.symlink(ABSTFN, ABSTFN + "link")
+                os.chdir(dirname(ABSTFN))
+                
+                base = basename(ABSTFN)
+                self.assertEqual(realpath(base + "link"), ABSTFN)
+                self.assertEqual(realpath(base + "link/k"), ABSTFN + "/k")
+            finally:
+                os.chdir(old_path)
+                self.safe_remove(ABSTFN + "link")
+                self.safe_rmdir(ABSTFN + "/k")
+                self.safe_rmdir(ABSTFN)
 
         # Convenience functions for removing temporary files.
         def pass_os_error(self, func, filename):



More information about the Python-checkins mailing list