Honor supybot-test's timeout option and document the units

Signed-off-by: James Vega <jamessan@users.sourceforge.net>
This commit is contained in:
James Vega 2011-08-22 14:07:39 -04:00 committed by Valentin Lorentz
parent fb66be5968
commit 5ada9193b9
2 changed files with 8 additions and 3 deletions

View File

@ -2,6 +2,7 @@
### ###
# Copyright (c) 2002-2005, Jeremiah Fincher # Copyright (c) 2002-2005, Jeremiah Fincher
# Copyright (c) 2011, James Vega
# All rights reserved. # All rights reserved.
# #
# Redistribution and use in source and binary forms, with or without # Redistribution and use in source and binary forms, with or without
@ -122,9 +123,10 @@ if __name__ == '__main__':
parser.add_option('-c', '--clean', action='store_true', default=False, parser.add_option('-c', '--clean', action='store_true', default=False,
dest='clean', help='Cleans the various data/conf/logs' dest='clean', help='Cleans the various data/conf/logs'
'directories before running tests.') 'directories before running tests.')
parser.add_option('-t', '--timeout', action='store', type='int', parser.add_option('-t', '--timeout', action='store', type='float',
dest='timeout', dest='timeout',
help='Sets the timeout for tests to return responses.') help='Sets the timeout, in seconds, for tests to return '
'responses.')
parser.add_option('-v', '--verbose', action='store_true', default=False, parser.add_option('-v', '--verbose', action='store_true', default=False,
help='Sets the verbose flag, logging extra information ' help='Sets the verbose flag, logging extra information '
'about each test that runs.') 'about each test that runs.')

View File

@ -1,5 +1,6 @@
### ###
# Copyright (c) 2002-2005, Jeremiah Fincher # Copyright (c) 2002-2005, Jeremiah Fincher
# Copyright (c) 2011, James Vega
# All rights reserved. # All rights reserved.
# #
# Redistribution and use in source and binary forms, with or without # Redistribution and use in source and binary forms, with or without
@ -60,6 +61,8 @@ network = True
# This is the global list of suites that are to be run. # This is the global list of suites that are to be run.
suites = [] suites = []
timeout = 10
originalCallbacksGetHelp = callbacks.getHelp originalCallbacksGetHelp = callbacks.getHelp
lastGetHelp = 'x' * 1000 lastGetHelp = 'x' * 1000
def cachingGetHelp(method, name=None, doc=None): def cachingGetHelp(method, name=None, doc=None):
@ -116,12 +119,12 @@ class PluginTestCase(SupyTestCase):
"""Subclass this to write a test case for a plugin. See """Subclass this to write a test case for a plugin. See
plugins/Plugin/test.py for an example. plugins/Plugin/test.py for an example.
""" """
timeout = 10
plugins = None plugins = None
cleanConfDir = True cleanConfDir = True
cleanDataDir = True cleanDataDir = True
config = {} config = {}
def __init__(self, methodName='runTest'): def __init__(self, methodName='runTest'):
self.timeout = timeout
originalRunTest = getattr(self, methodName) originalRunTest = getattr(self, methodName)
def runTest(self): def runTest(self):
run = True run = True