[py-svn] r57508 - in py/release/0.9.x/py/path: . local/testing

hpk at codespeak.net hpk at codespeak.net
Wed Aug 20 15:59:23 CEST 2008


Author: hpk
Date: Wed Aug 20 15:59:21 2008
New Revision: 57508

Modified:
   py/release/0.9.x/py/path/common.py
   py/release/0.9.x/py/path/local/testing/test_local.py
   py/release/0.9.x/py/path/local/testing/test_win.py
Log:
* fix relto method to operate with normcased names for windows.
* skip test for long filenames under windows, add url of martijns post. 



Modified: py/release/0.9.x/py/path/common.py
==============================================================================
--- py/release/0.9.x/py/path/common.py	(original)
+++ py/release/0.9.x/py/path/common.py	Wed Aug 20 15:59:21 2008
@@ -142,6 +142,9 @@
         #assert strrelpath[-1] == self.sep
         #assert strrelpath[-2] != self.sep
         strself = str(self)
+        if sys.platform == "win32":
+            strself = os.path.normcase(strself)
+            strrelpath = os.path.normcase(strrelpath)
         if strself.startswith(strrelpath):
             return strself[len(strrelpath):]
         return ""

Modified: py/release/0.9.x/py/path/local/testing/test_local.py
==============================================================================
--- py/release/0.9.x/py/path/local/testing/test_local.py	(original)
+++ py/release/0.9.x/py/path/local/testing/test_local.py	Wed Aug 20 15:59:21 2008
@@ -1,4 +1,5 @@
 import py
+import sys
 from py.path import local
 from py.__.path.common import checker
 from py.__.path.testing.fscommon import CommonFSTests, setuptestfs
@@ -178,6 +179,10 @@
         assert not hasattr(l3, 'commit')
 
     def test_long_filenames(self):
+        if sys.platform == "win32":
+            py.test.skip("win32: work around needed for path length limit")
+        # see http://codespeak.net/pipermail/py-dev/2008q2/000922.html
+        
         tmpdir = self.tmpdir
         # testing paths > 260 chars (which is Windows' limitation, but
         # depending on how the paths are used), but > 4096 (which is the

Modified: py/release/0.9.x/py/path/local/testing/test_win.py
==============================================================================
--- py/release/0.9.x/py/path/local/testing/test_win.py	(original)
+++ py/release/0.9.x/py/path/local/testing/test_win.py	Wed Aug 20 15:59:21 2008
@@ -29,6 +29,11 @@
         t2 = self.root.join("A_path")
         assert t1 == t1
         assert t1 == t2
+        
+    def test_relto_with_mixed_case(self):
+        t1 = self.root.join("a_path", "file")
+        t2 = self.root.join("A_path")
+        assert t1.relto(t2) == "file"
 
     def test_allow_unix_style_paths(self):
         t1 = self.root.join('a_path')



More information about the pytest-commit mailing list