[Numpy-svn] r3891 - trunk/numpy/testing

numpy-svn@scip... numpy-svn@scip...
Fri Jul 20 04:28:56 CDT 2007


Author: pearu
Date: 2007-07-20 04:28:37 -0500 (Fri, 20 Jul 2007)
New Revision: 3891

Modified:
   trunk/numpy/testing/numpytest.py
Log:
Added a new option to NumpyTest.run command line: -s somestring will replace sys.argv\[1:\] with splitcmdline(somestring)

Modified: trunk/numpy/testing/numpytest.py
===================================================================
--- trunk/numpy/testing/numpytest.py	2007-07-19 11:12:38 UTC (rev 3890)
+++ trunk/numpy/testing/numpytest.py	2007-07-20 09:28:37 UTC (rev 3891)
@@ -16,6 +16,7 @@
 
 DEBUG=0
 from numpy.testing.utils import jiffies
+from numpy.distutils.exec_command import splitcmdline
 get_frame = sys._getframe
 
 class IgnoreException(Exception):
@@ -605,7 +606,7 @@
         except ImportError:
             self.warn('Failed to import optparse module, ignoring.')
             return self.test()
-        usage = r'usage: %prog [-v <verbosity>] [-l <level>]'
+        usage = r'usage: %prog [-v <verbosity>] [-l <level>] [-s "<replacement of sys.argv[1:]>"]'
         parser = OptionParser(usage)
         parser.add_option("-v", "--verbosity",
                           action="store",
@@ -617,7 +618,14 @@
                           dest="level",
                           default=1,
                           type='int')
+        parser.add_option("-s", "--sys-argv",
+                          action="store",
+                          dest="sys_argv",
+                          default='',
+                          type='string')
         (options, args) = parser.parse_args()
+        if options.sys_argv:
+            sys.argv[1:] = splitcmdline(options.sys_argv)
         self.test(options.level,options.verbosity)
         return
 



More information about the Numpy-svn mailing list