Author: Ronny Pfannschmidt <ronny.pfannschm...@gmx.de>
Branch: refine-testrunner
Changeset: r61659:1ddcbccea251
Date: 2013-02-22 14:49 +0100
http://bitbucket.org/pypy/pypy/changeset/1ddcbccea251/

Log:    factor out win32 interp path fixing

diff --git a/testrunner/runner.py b/testrunner/runner.py
--- a/testrunner/runner.py
+++ b/testrunner/runner.py
@@ -1,14 +1,21 @@
-import sys, os, thread, Queue
+import sys
+import os
+import thread
+import Queue
 import py
 import util
 
-
-import optparse
-
 READ_MODE = 'rU'
 WRITE_MODE = 'wb'
 
 
+def fix_interppath_in_win32(path, cwd, _win32):
+    if (_win32 and not os.path.isabs(path) and
+       ('\\' in path or '/' in path)):
+        path = os.path.join(str(cwd), path)
+    return path
+
+
 def execute_args(cwd, test, logfname, interp, test_driver,
                  _win32=(sys.platform=='win32')):
     args = interp + test_driver
@@ -19,12 +26,7 @@
 
     args = map(str, args)
 
-    interp0 = args[0]
-    if (_win32 and not os.path.isabs(interp0) and
-        ('\\' in interp0 or '/' in interp0)):
-        args[0] = os.path.join(str(cwd), interp0)
-
-
+    args[0] = fix_interppath_in_win32(args[0], cwd, _win32)
     return args
 
 
@@ -124,13 +126,13 @@
             run_param.log("++ starting %s [%d started in total]",
                           res[1], started)
             continue
-        
+
         testname, somefailed, logdata, output = res[1:]
         done += 1
         failure = failure or somefailed
 
         heading = "__ %s [%d done in total] " % (testname, done)
-        
+
         run_param.log(heading.ljust(79, '_'))
 
         run_param.log(output.rstrip())
@@ -224,7 +226,6 @@
 
 def main(opts, args, RunParamClass):
 
-
     if opts.logfile is None:
         print "no logfile specified"
         sys.exit(2)
@@ -255,10 +256,9 @@
     else:
         run_param.collect_testdirs(testdirs)
 
-
     if opts.dry_run:
         run_param.log("%s", run_param.__dict__)
-    
+
     res = execute_tests(run_param, testdirs, logfile)
 
     if res:
_______________________________________________
pypy-commit mailing list
pypy-commit@python.org
http://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to