[py-svn] r23763 - in py/dist/py/path/local: . testing

briandorsey at codespeak.net briandorsey at codespeak.net
Tue Feb 28 18:19:52 CET 2006


Author: briandorsey
Date: Tue Feb 28 18:19:51 2006
New Revision: 23763

Modified:
   py/dist/py/path/local/local.py
   py/dist/py/path/local/testing/test_win.py
Log:
Allow unix style paths (forward slashes) even on windows. 


Modified: py/dist/py/path/local/local.py
==============================================================================
--- py/dist/py/path/local/local.py	(original)
+++ py/dist/py/path/local/local.py	Tue Feb 28 18:19:51 2006
@@ -165,6 +165,10 @@
                     break
         for arg in strargs: 
             arg = arg.strip(sep) 
+            if py.std.sys.platform == 'win32': 
+                # allow unix style paths even on windows. 
+                arg = arg.strip('/') 
+                arg = arg.replace('/', sep)
             if arg: 
                 if not strpath.endswith(sep): 
                     strpath += sep 

Modified: py/dist/py/path/local/testing/test_win.py
==============================================================================
--- py/dist/py/path/local/testing/test_win.py	(original)
+++ py/dist/py/path/local/testing/test_win.py	Tue Feb 28 18:19:51 2006
@@ -24,3 +24,11 @@
             self.root.chmod(mode)
             assert self.root.stat().st_mode == mode
 
+    def test_allow_unix_style_paths(self):
+        t1 = self.root.join('a_path')
+        assert t1 == str(self.root) + '\\a_path'
+        t1 = self.root.join('a_path/')
+        assert t1 == str(self.root) + '\\a_path'
+        t1 = self.root.join('dir/a_path')
+        assert t1 == str(self.root) + '\\dir\\a_path'
+        



More information about the pytest-commit mailing list