changeset 21376:e4366bc08879

run-tests: move option parser logic to TestRunner.run()
author Gregory Szorc <gregory.szorc@gmail.com>
date Sun, 20 Apr 2014 10:08:33 -0700
parents bd70dcb91af6
children 71081f7f9e52
files tests/run-tests.py
diffstat 1 files changed, 6 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/tests/run-tests.py	Sun Apr 20 10:06:19 2014 -0700
+++ b/tests/run-tests.py	Sun Apr 20 10:08:33 2014 -0700
@@ -1014,10 +1014,14 @@
         self.abort = [False]
         self._createdfiles = []
 
-    def run(self, args):
+    def run(self, args, parser=None):
         """Run the test suite."""
         oldmask = os.umask(022)
         try:
+            parser = parser or getparser()
+            options, args = parseargs(args, parser)
+            self.options = options
+
             self._checktools()
             tests = self.findtests(args)
             return self._run(tests)
@@ -1460,11 +1464,7 @@
 def main(args, runner=None, parser=None):
     runner = runner or TestRunner()
 
-    parser = parser or getparser()
-    (options, args) = parseargs(args, parser)
-    runner.options = options
-
-    return runner.run(args)
+    return runner.run(args, parser=parser)
 
 if __name__ == '__main__':
     sys.exit(main(sys.argv[1:]))