tests/run-tests.py
branchstable
changeset 1363 58a33a3ed565
parent 1361 1d3aa8779efb
child 1364 772a53435e14
--- a/tests/run-tests.py	Fri Feb 28 02:09:00 2014 +0100
+++ b/tests/run-tests.py	Mon Mar 24 21:37:33 2014 -0700
@@ -133,7 +133,7 @@
         f.close()
     return entries
 
-def parseargs():
+def parseargs(args):
     parser = optparse.OptionParser("%prog [options] [tests]")
 
     # keep these sorted
@@ -210,7 +210,7 @@
     for option, (envvar, default) in defaults.items():
         defaults[option] = type(default)(os.environ.get(envvar, default))
     parser.set_defaults(**defaults)
-    (options, args) = parser.parse_args()
+    (options, args) = parser.parse_args(args)
 
     # jython is always pure
     if 'java' in sys.platform or '__pypy__' in sys.modules:
@@ -1176,8 +1176,8 @@
 testtypes = [('.py', pytest, '.out'),
              ('.t', tsttest, '')]
 
-def main():
-    (options, args) = parseargs()
+def main(args):
+    (options, args) = parseargs(args)
     os.umask(022)
 
     checktools()
@@ -1299,4 +1299,4 @@
         cleanup(options)
 
 if __name__ == '__main__':
-    main()
+    main(sys.argv[1:])