[pypy-commit] pypy refine-testrunner: testrunner: make scratchbox runner use a RunParam subclass

RonnyPfannschmidt noreply at buildbot.pypy.org
Sun Jul 1 17:56:15 CEST 2012


Author: Ronny Pfannschmidt <Ronny.Pfannschmidt at gmx.de>
Branch: refine-testrunner
Changeset: r55887:8a4b1802f7a7
Date: 2012-07-01 17:55 +0200
http://bitbucket.org/pypy/pypy/changeset/8a4b1802f7a7/

Log:	testrunner: make scratchbox runner use a RunParam subclass

diff --git a/testrunner/runner.py b/testrunner/runner.py
--- a/testrunner/runner.py
+++ b/testrunner/runner.py
@@ -217,7 +217,7 @@
                 self.collect_testdirs(testdirs, p1)
 
 
-def main(opts, args):
+def main(opts, args, RunParamClass):
 
 
     if opts.logfile is None:
@@ -232,7 +232,7 @@
 
     testdirs = []
 
-    run_param = RunParam.from_options(opts, out)
+    run_param = RunParamClass.from_options(opts, out)
     # the config files are python files whose run overrides the content
     # of the run_param instance namespace
     # in that code function overriding method should not take self
@@ -261,4 +261,4 @@
 
 if __name__ == '__main__':
     opts, args = util.parser.parse_args()
-    main(opts, args)
+    main(opts, args, RunParam)
diff --git a/testrunner/scratchbox_runner.py b/testrunner/scratchbox_runner.py
--- a/testrunner/scratchbox_runner.py
+++ b/testrunner/scratchbox_runner.py
@@ -5,23 +5,14 @@
 
 import os
 
-def args_for_scratchbox(cwd, args):
-    return ['/scratchbox/login', '-d', str(cwd)] + args
+import runner
 
-def run_scratchbox(args, cwd, out, timeout=None):
-    return run(args_for_scratchbox(cwd, args), cwd, out, timeout)
+class ScratchboxRunParam(runner.RunParam):
+    def __init__(self, root, out):
+        super(ScratchboxRunParam, self).__init__(root, out)
+        self.interp = ['/scratchbox/login', '-d', str(root)] + self.interp
 
-def dry_run_scratchbox(args, cwd, out, timeout=None):
-    return dry_run(args_for_scratchbox(cwd, args), cwd, out, timeout)
 
 if __name__ == '__main__':
-    import runner
-    # XXX hack hack hack
-    dry_run = runner.dry_run
-    run = runner.run
-
-    runner.dry_run = dry_run_scratchbox
-    runner.run = run_scratchbox
-
-    import sys
-    runner.main(sys.argv)
+    opts, args = runner.util.parser.parse_args()
+    runner.main(opts, args, ScratchboxRunParam)


More information about the pypy-commit mailing list