]> arthur.barton.de Git - bup.git/commitdiff
Use os.path rather than '/' logic in wvtest
authorBrandon Low <lostlogic@lostlogicx.com>
Sat, 22 Jan 2011 19:24:46 +0000 (11:24 -0800)
committerAvery Pennarun <apenwarr@gmail.com>
Wed, 26 Jan 2011 03:49:06 +0000 (19:49 -0800)
Signed-off-by: Brandon Low <lostlogic@lostlogicx.com>
wvtest.py

index fd6994eeae5ee616d314ceb52e06d05ed8f399c2..86c37a3ccdd18e9ba1d1833592c31a1550220f21 100755 (executable)
--- a/wvtest.py
+++ b/wvtest.py
@@ -125,8 +125,7 @@ else:  # we're the main program
             print
             print traceback.format_exc()
             tb = sys.exc_info()[2]
-            wvtest._result(e, traceback.extract_tb(tb)[1],
-                           'EXCEPTION')
+            wvtest._result(e, traceback.extract_tb(tb)[1], 'EXCEPTION')
 
     # main code
     for modname in sys.argv[1:]:
@@ -140,11 +139,10 @@ else:  # we're the main program
         oldwd = os.getcwd()
         oldpath = sys.path
         try:
-            modpath = os.path.abspath(modname).split('/')[:-1]
-            os.chdir('/'.join(modpath))
-            sys.path += ['/'.join(modpath),
-                         '/'.join(modpath[:-1])]
-            mod = __import__(modname.replace('/', '.'), None, None, [])
+            path, mod = os.path.split(os.path.abspath(modname))
+            os.chdir(path)
+            sys.path += [path, os.path.split(path)[0]]
+            mod = __import__(modname.replace(os.path.sep, '.'), None, None, [])
             for t in wvtest._registered:
                 _runtest(modname, t.func_name, t)
                 print