summaryrefslogtreecommitdiffstats
path: root/pykolab/tests/__init__.py
diff options
context:
space:
mode:
authorJeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>2012-03-02 15:46:35 +0000
committerJeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>2012-03-02 15:46:35 +0000
commit2d7c188c7bea6932918d74715c32b2575358dd4a (patch)
tree5f2dfa5667d5ff470e7f6589bd8a067dc792e574 /pykolab/tests/__init__.py
parent3533710ef014bf541daa2d0107bae8b34a8e9a20 (diff)
downloadpykolab-2d7c188c7bea6932918d74715c32b2575358dd4a.tar.gz
Redo test suites
Diffstat (limited to 'pykolab/tests/__init__.py')
-rw-r--r--pykolab/tests/__init__.py57
1 files changed, 23 insertions, 34 deletions
diff --git a/pykolab/tests/__init__.py b/pykolab/tests/__init__.py
index 9b902be..3aefdc3 100644
--- a/pykolab/tests/__init__.py
+++ b/pykolab/tests/__init__.py
@@ -26,7 +26,6 @@ import time
import pykolab
from pykolab.constants import *
-from pykolab.tests.constants import *
from pykolab.translate import _
log = pykolab.getLogger('pykolab.tests')
@@ -34,16 +33,11 @@ conf = pykolab.getConf()
class Tests(object):
def __init__(self):
+ import tests
+ tests.__init__()
test_group = conf.add_cli_parser_option_group(_("Test Options"))
- for item in TEST_ITEMS:
- test_group.add_option( "--%s" %(item['name']),
- dest = "%s" %(item['name']),
- action = "store_true",
- default = False,
- help = _("Submit a number of items to the %s") %(item['mailbox']))
-
test_group.add_option( "--suite",
dest = "test_suites",
action = "append",
@@ -51,33 +45,28 @@ class Tests(object):
help = _("Run tests in suite SUITE. Implies a certain set of items being tested."),
metavar = "SUITE")
- delivery_group = conf.add_cli_parser_option_group(_("Content Delivery Options"))
-
- delivery_group.add_option( "--use-mail",
- dest = "use_mail",
- action = "store_true",
- default = False,
- help = _("Send messages containing the items through mail (requires proper infrastructure)"))
+ conf.finalize_conf()
- delivery_group.add_option( "--use-imap",
- dest = "use_imap",
- action = "store_true",
- default = False,
- help = _("Inject messages containing the items through IMAP"))
+ def run(self):
+ if len(conf.test_suites) > 0:
+ for test_suite in conf.test_suites:
+ print test_suite
+ else:
+ to_execute = []
- delivery_group.add_option( "--use-lmtp",
- dest = "use_lmtp",
- action = "store_true",
- default = False,
- help = _("Deliver messages containing the items through LMTP"))
+ arg_num = 0
+ for arg in sys.argv[1:]:
+ print "arg", arg
+ arg_num += 1
+ if not arg.startswith('-') and len(sys.argv) >= arg_num:
+ if tests.tests.has_key(sys.argv[arg_num].replace('-','_')):
+ print "tests.tests.has_key", sys.argv[arg_num].replace('-','_')
+ to_execute.append(sys.argv[arg_num].replace('-','_'))
- conf.finalize_conf()
+ print "to_execute", to_execute
+ if len(to_execute) > 0:
+ print "'_'.join(to_execute)", '_'.join(to_execute)
+ tests.execute('_'.join(to_execute))
+ else:
+ tests.execute('help')
- def run(self):
- # Execute the suites first.
- for suite in conf.test_suites:
- try:
- exec("from pykolab.tests.%s import %sTest" %(suite,suite.capitalize()))
- exec("%stest = %sTest()" %(suite,suite.capitalize()))
- except ImportError, e:
- conf.log.error(_("Tests for suite %s failed to load. Aborting.") %(suite.capitalize()))