Added timeout and plugindir options.

This commit is contained in:
Jeremy Fincher 2003-10-09 16:59:12 +00:00
parent 30b054c6cb
commit 8df7fb6064

View File

@ -298,12 +298,23 @@ if __name__ == '__main__':
parser.add_option('-e', '--exclude', action='append', parser.add_option('-e', '--exclude', action='append',
dest='exclusions', metavar='TESTFILE', dest='exclusions', metavar='TESTFILE',
help='Exclude this test from the test run.') help='Exclude this test from the test run.')
parser.add_option('-t', '--timeout', action='store', type='int',
dest='timeout',
help='Sets the timeout for tests to return responses.')
parser.add_option('-p', '--plugindir', action='append',
metavar='plugindir', dest='plugindirs',
help='Adds a directory to the list of directories in '
'which to search for plugins.')
(options, args) = parser.parse_args() (options, args) = parser.parse_args()
if not args: if not args:
args = glob.glob(os.path.join('test', 'test_*.py')) args = glob.glob(os.path.join('test', 'test_*.py'))
if options.exclusions: if options.exclusions:
for name in options.exclusions: for name in options.exclusions:
args = [s for s in args if s != name] args = [s for s in args if s != name]
if options.timeout:
PluginTestCase.timeout = options.timeout
if options.plugindirs:
conf.pluginDirs.extend(options.plugindirs)
world.testing = True world.testing = True
names = [os.path.splitext(os.path.basename(name))[0] for name in args] names = [os.path.splitext(os.path.basename(name))[0] for name in args]