[py-svn] r51997 - py/branch/guido-svn-auth/py/path/svn/testing

guido at codespeak.net guido at codespeak.net
Sat Mar 1 14:10:27 CET 2008


Author: guido
Date: Sat Mar  1 14:10:26 2008
New Revision: 51997

Modified:
   py/branch/guido-svn-auth/py/path/svn/testing/test_wccommand.py
Log:
made that tests that depend on win32all are skipped if the lib isn't installed

Modified: py/branch/guido-svn-auth/py/path/svn/testing/test_wccommand.py
==============================================================================
--- py/branch/guido-svn-auth/py/path/svn/testing/test_wccommand.py	(original)
+++ py/branch/guido-svn-auth/py/path/svn/testing/test_wccommand.py	Sat Mar  1 14:10:26 2008
@@ -1,4 +1,5 @@
 import py
+import sys
 from py.__.path.svn.testing.svntestbase import CommonSvnTests, getrepowc
 from py.__.path.svn.wccommand import InfoSvnWCCommand
 from py.__.path.svn.wccommand import parse_wcinfotime
@@ -7,16 +8,20 @@
 if py.path.local.sysfind('svn') is None:
     py.test.skip("cannot test py.path.svn, 'svn' binary not found")
 
-try:
-    import win32api
-except ImportError:
+if sys.platform != 'win32':
     def normpath(p):
         return p
 else:
-    import os
-    def normpath(p):
-        p = win32api.GetShortPathName(p)
-        return os.path.normpath(os.path.normcase(p))
+    try:
+        import win32api
+    except ImportError:
+        def normpath(p):
+            py.test.skip('this test requires win32api to run on windows')
+    else:
+        import os
+        def normpath(p):
+            p = win32api.GetShortPathName(p)
+            return os.path.normpath(os.path.normcase(p))
 
 class TestWCSvnCommandPath(CommonSvnTests):
 



More information about the pytest-commit mailing list