Ronny Pfannschmidt avatar Ronny Pfannschmidt committed 8a4b180

testrunner: make scratchbox runner use a RunParam subclass

Comments (0)

Files changed (2)

testrunner/runner.py

                 self.collect_testdirs(testdirs, p1)
 
 
-def main(opts, args):
+def main(opts, args, RunParamClass):
 
 
     if opts.logfile is None:
 
     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
 
 if __name__ == '__main__':
     opts, args = util.parser.parse_args()
-    main(opts, args)
+    main(opts, args, RunParam)

testrunner/scratchbox_runner.py

 
 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)
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.