From f20f87bbfde7a5feabeb428d8db309b2f5dcc67d Mon Sep 17 00:00:00 2001 From: Pearu Peterson Date: Fri, 20 Jul 2007 09:28:37 +0000 Subject: Added a new option to NumpyTest.run command line: -s somestring will replace sys.argv\[1:\] with splitcmdline(somestring) --- numpy/testing/numpytest.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'numpy/testing/numpytest.py') diff --git a/numpy/testing/numpytest.py b/numpy/testing/numpytest.py index da09a830d..41efb60ad 100644 --- a/numpy/testing/numpytest.py +++ b/numpy/testing/numpytest.py @@ -16,6 +16,7 @@ __all__ = ['set_package_path', 'set_local_path', 'restore_path', 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 @@ class NumpyTest: except ImportError: self.warn('Failed to import optparse module, ignoring.') return self.test() - usage = r'usage: %prog [-v ] [-l ]' + usage = r'usage: %prog [-v ] [-l ] [-s ""]' parser = OptionParser(usage) parser.add_option("-v", "--verbosity", action="store", @@ -617,7 +618,14 @@ class NumpyTest: 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 -- cgit v1.2.1