def unitTestSuite(): test_suite = unittest.TestSuite() test_suite.addTest(unittest.findTestCases(test_achievements)) test_suite.addTest(unittest.findTestCases(test_game_store)) test_suite.addTest(unittest.findTestCases(test_ladder)) test_suite.addTest(unittest.findTestCases(test_pundit)) test_suite.addTest(unittest.findTestCases(transforms)) return test_suite
def suite(): suite = unittest.TestSuite() suite.addTest(unittest.findTestCases(test_util)) suite.addTest(unittest.findTestCases(test_mythdb)) suite.addTest(unittest.findTestCases(test_mythtv)) suite.addTest(unittest.findTestCases(test_domain)) suite.addTest(unittest.findTestCases(test_player)) return suite
def test_suite(): from node.ext.ugm.tests import test_api from node.ext.ugm.tests import test_file suite = unittest.TestSuite() suite.addTest(unittest.findTestCases(test_api)) suite.addTest(unittest.findTestCases(test_file)) return suite
def test_suite(): from cone.zodb.tests import test_common from cone.zodb.tests import test_entry from cone.zodb.tests import test_indexing from cone.zodb.tests import test_catalog suite = unittest.TestSuite() suite.addTest(unittest.findTestCases(test_common)) suite.addTest(unittest.findTestCases(test_entry)) suite.addTest(unittest.findTestCases(test_indexing)) suite.addTest(unittest.findTestCases(test_catalog)) return suite
def suite(): modules_to_test = ( 'lru', 'ast', 'pygen', 'lexer', 'template', 'lookup', 'def', 'namespace', 'filters', 'inheritance', 'call', 'cache', 'exceptions_', 'babelplugin', 'tgplugin' ) alltests = unittest.TestSuite() for name in modules_to_test: mod = __import__(name) for token in name.split('.')[1:]: mod = getattr(mod, token) alltests.addTest(unittest.findTestCases(mod, suiteClass=None)) return alltests
def main(verbose): basenames = [ "test_template", "test_engine", "test_preprocess", "test_htmlhelper", "test_main", "test_encoding", "test_users_guide", "test_faq", "test_examples", ] if python3: basenames.remove("test_encoding") if verbose: import os for basename in basenames: print('') print("************************************************* " + basename) os.system("python %s.py" % basename) else: import unittest suite = unittest.TestSuite() for basename in basenames: test_module = __import__(basename) suite.addTest(unittest.findTestCases(test_module)) unittest.TextTestRunner(verbosity=1).run(suite)
def suite(): alltests = unittest.TestSuite() for mod in get_testmods(): alltests.addTest(unittest.findTestCases(mod)) return alltests
def buildSuite(): suite = unittest.TestSuite() for mod in map(__import__, [ os.path.basename(os.path.splitext(file)[0]) for file in glob(testdir + '/*_test.py') ]): suite.addTest(unittest.findTestCases(mod)) return suite
def main(port, tests, verbosity): if not tests: tests = os.listdir(os.path.dirname(__file__)) tests = [os.path.splitext(t)[0] for t in tests] # find files and the tests in them mainsuite = unittest.TestSuite() for modulename in tests: try: module = __import__(modulename) except ImportError: print("skipping %s" % modulename) else: module.PORT = port testsuite = unittest.findTestCases(module) print( "found %s tests in %r" % (testsuite.countTestCases(), modulename)) mainsuite.addTest(testsuite) # run the collected tests testRunner = unittest.TextTestRunner(verbosity=verbosity) result = testRunner.run(mainsuite) # set exit code according to test results return (0 if result.wasSuccessful() else 1)
def suite(): modules_to_test = find_modules_and_add_paths(os.getcwd()) alltests = unittest.TestSuite() for module in map(__import__, modules_to_test): alltests.addTest(unittest.findTestCases(module)) return alltests
def suite(): """ Create a test suite for this module. """ # We need to do some magic stuff here. We want to load up all the test # cases twice: once for each setting of the bDomlette flag. So we need # to get an explicit module reference, and load the cases manually. mod = sys.modules[__name__] suite = unittest.TestSuite() global bDomlette bDomlette = False suite.addTest(unittest.findTestCases(mod)) bDomlette = True suite.addTest(unittest.findTestCases(mod)) return suite
def suite(): modules = ['testConnection', 'testConnectionManager', 'testPool', 'testQuery', 'testTransaction', 'testLogging'] alltests = unittest.TestSuite() for module in map(__import__, modules): alltests.addTest(unittest.findTestCases(module)) return alltests
def main(options=None): op = options or optparse.OptionParser() op.add_option('-b', '--browser', dest='browser', default='ie', help='Specify the browser to use [ie/firefox]') op.add_option('-u', '--url', dest='url', help='Specify the URL to load in the browser') op.add_option('-v', '--verbose', dest='verbose', action='store_true') op.add_option('-q', '--quiet', dest='quiet', action='store_true') # Blacklist of members of optparse.Values to ignore blacklist = dir(optparse.Values) opts, args = op.parse_args() kwargs = dict([(k, getattr(opts, k)) for k in dir(opts) if not k in blacklist]) kwargs.pop('quiet') kwargs.pop('verbose') kwargs['verbosity'] = 1 if opts.quiet: kwargs['verbosity'] = 0 if opts.verbose: kwargs['verbosity'] = 2 tests = unittest.findTestCases(sys.modules['__main__']) runner = WatinTestRunner(**kwargs) rc = runner.run(tests) if not rc.wasSuccessful(): sys.exit(1)
def suite(): modules = ["testConnection", "testPool", "testQuery", "testTransaction", "testLogging"] alltests = unittest.TestSuite() for module in map(__import__, modules): alltests.addTest(unittest.findTestCases(module)) return alltests
def suite(): modules_to_test = ( 'sql.testtypes', 'sql.columns', 'sql.constraints', 'sql.generative', # SQL syntax 'sql.select', 'sql.selectable', 'sql.case_statement', 'sql.labels', 'sql.unicode', # assorted round-trip tests 'sql.functions', 'sql.query', 'sql.quote', 'sql.rowcount', # defaults, sequences (postgres/oracle) 'sql.defaults', ) alltests = unittest.TestSuite() for name in modules_to_test: mod = __import__(name) for token in name.split('.')[1:]: mod = getattr(mod, token) alltests.addTest(unittest.findTestCases(mod, suiteClass=None)) return alltests
def run_test(): import sys sys.path.extend(["/home/rinze/dev/lib/Pyro4/src/", "/home/rinze/dev/odemis/src", "/home/rinze/dev/odemis/src/gui", "/home/rinze/dev/misc/"]) import unittest import os import logging import odemis.gui.test as test print "\n** Gathering all Odemis GUI TestCases...\n" alltests = unittest.TestSuite() path = os.path.dirname(os.path.realpath(__file__)) for _, _, files in os.walk(path): modules_to_test = [x[:-3] for x in files if x.endswith('test.py')] for file_name in sorted(modules_to_test): print " * Adding module %s" % file_name module = __import__(file_name) logging.getLogger().setLevel(logging.ERROR) module.INSPECT = False module.MANUAL = False module.SLEEP_TIME = 10 alltests.addTest(unittest.findTestCases(module)) result = unittest.TestResult() test.INSPECT = False test.MANUAL = False test.SLEEP_TIME = 10 print "\n** Running..." alltests.run(result) num_errors = len(result.errors) print "\n** %d Errors occured" % num_errors for error in result.errors: print " * %s" % error[0] for line in error[1].splitlines(): print " %s" % line num_failures = len(result.failures) print "\n** %d Failures occured\n" % num_failures for failure in result.failures: print " * %s" % failure[0] for line in failure[1].splitlines(): print " %s" % line print "** Done."
def suite(): modules_to_test = ( 'test_codes', 'test_dataele', 'test_map_if', 'test_map_index', 'test_map_unique', 'test_map_walker', 'test_params', 'test_path', 'test_rawx12file', 'test_segment', 'test_syntax', 'test_validation', 'test_x12context', 'test_x12file', 'test_x12n_document', 'test_xmlwriter', 'test_x12n_document', 'test_xmlx12_simple', ) alltests = unittest.TestSuite() for module in map(__import__, modules_to_test): alltests.addTest(unittest.findTestCases(module)) return alltests
def suite(): modules_to_test = map( lambda x: x[:-3], glob.glob("tests/*.py" )) alltests = unittest.TestSuite() for module in map(__import__, modules_to_test): alltests.addTest(unittest.findTestCases(module)) return alltests
def suite(): modules_to_test = ('LFSR_ut', 'Axis3_ut', 'Quaternion_ut', \ 'Grid_ut', 'Map_ut', 'Ligand_ut', 'Dock_ut') alltests = unittest.TestSuite() for module in map(__import__, modules_to_test): alltests.addTest(unittest.findTestCases(module)) return alltests
def main(): parser = OptionParser(usage="%prog [options] [files]") add = parser.add_option add("--conf", dest="conf", metavar="CONF", help="set the conf file") add("--profile", dest="profile", action="store_true", default=False, help="turn on hotshot profiling") add("--dump", dest="dump", action="store_true", default=False, help="dump this script") add("--unittest", dest="unittest", action="store_true", default=False, help="run the python unittests") add("--quiet", dest="verbosity", action="store_const", const=0, help="minimal output") add("--verbose", dest="verbosity", action="store_const", const=2, help="verbose output") add("--help:conf", dest="showdefaultconf", action="store_true", default=False, help="display the default configuration file") parser.set_defaults(verbosity=1) options, args = parser.parse_args() if len(sys.argv) == 1: parser.print_help() sys.exit() if options.showdefaultconf: print conf.DEFAULT_CONF sys.exit() conf_ = conf.Conf() if options.conf: conf_.loadfile(options.conf) profile_func = _profile_disabled if options.profile: profile_func = _profile_enabled if options.unittest: suite = unittest.TestSuite(); for module in [conf, htmlparse, jsparse, lint, util]: suite.addTest(unittest.findTestCases(module)) runner = unittest.TextTestRunner(verbosity=options.verbosity) runner.run(suite) paths = [] for recurse, path in conf_['paths']: paths.extend(_resolve_paths(path, recurse)) for arg in args: paths.extend(_resolve_paths(arg, False)) if options.dump: profile_func(_dump, paths) else: profile_func(_lint, paths, conf_) if _lint_results['errors']: sys.exit(3) if _lint_results['warnings']: sys.exit(1) sys.exit(1)
def suite(): #testMods = [fName.rstrip(".py") for fName in glob.glob("*suite.py")] testMods = ['analysissuite', 'fieldssuite', 'imagessuite'] # TODO: others need fixing alltests = unittest.TestSuite() for module in map(__import__, testMods): alltests.addTest(unittest.findTestCases(module)) return alltests
def suite(): modules_to_test = ('config_settings_test', 'document_manipulator_test', 'localization_test') alltests = unittest.TestSuite() for module in map(__import__, modules_to_test): alltests.addTest(unittest.findTestCases(module)) return alltests
def suite(): sys.path.append(os.getcwd()) modules_to_test = find_all_test_files() print 'Testing', ', '.join(modules_to_test) alltests = unittest.TestSuite() for module in map(__import__, modules_to_test): alltests.addTest(unittest.findTestCases(module)) return alltests
def suite(): modules_to_test = ( \ 'test_core' ) alltests = unittest.TestSuite() for module in map(__import__, modules_to_test): alltests.addTest(unittest.findTestCases(module)) return alltests
def suite(): modules_to_test = ('actionTests', 'analysisTests', 'documentTests', \ 'eventTests', 'guiTests', 'interpreterTests', \ 'plotTests') alltests = unittest.TestSuite() for module in map(__import__, modules_to_test): alltests.addTest(unittest.findTestCases(module)) return alltests
def main(): suite = unittest.TestSuite() for package in packages: suite.addTests(unittest.findTestCases(package)) runner = unittest.TextTestRunner() runner.run(suite)
def suite(): modules_to_test = ( 'testcase_pcscreadergroups', ) testsuite_framework = unittest.TestSuite() for module in map(__import__, modules_to_test): testsuite_framework.addTest(unittest.findTestCases(module)) return testsuite_framework
def suite(): alltests = TestSuite() for module_name in get_test_module_names(): module = __import__(module_name, fromlist=[module_name]) alltests.addTest(findTestCases(module)) return alltests
def test(): """ Run some tests. """ import unittest from . import test runner = unittest.TextTestRunner() suite = unittest.findTestCases(test) runner.run(suite)
def test_suite(): import sys suite = unittest.findTestCases(sys.modules[__name__]) suite.addTests(( doctest.DocFileSuite( 'transmogrifier.txt', setUp=setUp, tearDown=tearDown), )) return suite
def integration_test_suite(): test_suite = unittest.TestSuite() test_suite.addTest(unittest.findTestCases(test_add)) test_suite.addTest(unittest.findTestCases(test_delete)) return test_suite
def test_suite(): from cone.ugm.tests import test_layout from cone.ugm.tests import test_localmanager from cone.ugm.tests import test_settings from cone.ugm.tests import test_utils from cone.ugm.tests import test_model_group from cone.ugm.tests import test_model_groups from cone.ugm.tests import test_model_user from cone.ugm.tests import test_model_users from cone.ugm.tests import test_browser_actions from cone.ugm.tests import test_browser_autoincrement from cone.ugm.tests import test_browser_expires from cone.ugm.tests import test_browser_group from cone.ugm.tests import test_browser_groups from cone.ugm.tests import test_browser_portrait from cone.ugm.tests import test_browser_principal from cone.ugm.tests import test_browser_remote from cone.ugm.tests import test_browser_roles from cone.ugm.tests import test_browser_root from cone.ugm.tests import test_browser_settings from cone.ugm.tests import test_browser_user from cone.ugm.tests import test_browser_users from cone.ugm.tests import test_browser_utils suite = unittest.TestSuite() suite.addTest(unittest.findTestCases(test_layout)) suite.addTest(unittest.findTestCases(test_localmanager)) suite.addTest(unittest.findTestCases(test_settings)) suite.addTest(unittest.findTestCases(test_utils)) suite.addTest(unittest.findTestCases(test_model_group)) suite.addTest(unittest.findTestCases(test_model_groups)) suite.addTest(unittest.findTestCases(test_model_user)) suite.addTest(unittest.findTestCases(test_model_users)) suite.addTest(unittest.findTestCases(test_browser_actions)) suite.addTest(unittest.findTestCases(test_browser_autoincrement)) suite.addTest(unittest.findTestCases(test_browser_expires)) suite.addTest(unittest.findTestCases(test_browser_group)) suite.addTest(unittest.findTestCases(test_browser_groups)) suite.addTest(unittest.findTestCases(test_browser_portrait)) suite.addTest(unittest.findTestCases(test_browser_principal)) suite.addTest(unittest.findTestCases(test_browser_remote)) suite.addTest(unittest.findTestCases(test_browser_roles)) suite.addTest(unittest.findTestCases(test_browser_root)) suite.addTest(unittest.findTestCases(test_browser_settings)) suite.addTest(unittest.findTestCases(test_browser_user)) suite.addTest(unittest.findTestCases(test_browser_users)) suite.addTest(unittest.findTestCases(test_browser_utils)) return suite
def test_suite(): from cone.app.tests import test_testing from cone.app.tests import test_app from cone.app.tests import test_model from cone.app.tests import test_security from cone.app.tests import test_ugm from cone.app.tests import test_utils from cone.app.tests import test_workflow from cone.app.tests import test_browser from cone.app.tests import test_browser_actions from cone.app.tests import test_browser_ajax from cone.app.tests import test_browser_authoring from cone.app.tests import test_browser_batch from cone.app.tests import test_browser_content from cone.app.tests import test_browser_contents from cone.app.tests import test_browser_contextmenu from cone.app.tests import test_browser_copysupport from cone.app.tests import test_browser_exception from cone.app.tests import test_browser_form from cone.app.tests import test_browser_layout from cone.app.tests import test_browser_login from cone.app.tests import test_browser_referencebrowser from cone.app.tests import test_browser_resources from cone.app.tests import test_browser_settings from cone.app.tests import test_browser_sharing from cone.app.tests import test_browser_table from cone.app.tests import test_browser_utils from cone.app.tests import test_browser_workflow suite = unittest.TestSuite() suite.addTest(unittest.findTestCases(test_testing)) suite.addTest(unittest.findTestCases(test_app)) suite.addTest(unittest.findTestCases(test_model)) suite.addTest(unittest.findTestCases(test_security)) suite.addTest(unittest.findTestCases(test_ugm)) suite.addTest(unittest.findTestCases(test_utils)) suite.addTest(unittest.findTestCases(test_workflow)) suite.addTest(unittest.findTestCases(test_browser)) suite.addTest(unittest.findTestCases(test_browser_actions)) suite.addTest(unittest.findTestCases(test_browser_ajax)) suite.addTest(unittest.findTestCases(test_browser_authoring)) suite.addTest(unittest.findTestCases(test_browser_batch)) suite.addTest(unittest.findTestCases(test_browser_content)) suite.addTest(unittest.findTestCases(test_browser_contents)) suite.addTest(unittest.findTestCases(test_browser_contextmenu)) suite.addTest(unittest.findTestCases(test_browser_copysupport)) suite.addTest(unittest.findTestCases(test_browser_exception)) suite.addTest(unittest.findTestCases(test_browser_form)) suite.addTest(unittest.findTestCases(test_browser_layout)) suite.addTest(unittest.findTestCases(test_browser_login)) suite.addTest(unittest.findTestCases(test_browser_referencebrowser)) suite.addTest(unittest.findTestCases(test_browser_resources)) suite.addTest(unittest.findTestCases(test_browser_settings)) suite.addTest(unittest.findTestCases(test_browser_sharing)) suite.addTest(unittest.findTestCases(test_browser_table)) suite.addTest(unittest.findTestCases(test_browser_utils)) suite.addTest(unittest.findTestCases(test_browser_workflow)) return suite
#!/usr/bin/env python # -*- coding: utf-8 -*- """ test_suite_portals author(s): Albert origin: 05-14-2017 """ import unittest, sys from pathlib import Path sys.path.insert(0, str(Path(__file__).parent.parent.resolve())) from . import test_txt_portal, test_hdf5_portal #, test_paths_portal if __name__ == '__main__': suite = unittest.TestSuite() suite.addTest(unittest.findTestCases(test_txt_portal)) suite.addTest(unittest.findTestCases(test_hdf5_portal)) #suite.addTest(unittest.findTestCases(test_paths_portal)) runner = unittest.TextTestRunner() runner.run(suite)
def suite(): modules_to_test = ('testcase_pcscreadergroups', ) testsuite_framework = unittest.TestSuite() for module in map(__import__, modules_to_test): testsuite_framework.addTest(unittest.findTestCases(module)) return testsuite_framework
def __init__(self, name): try: super(EasyTestSuite, self).__init__(findTestCases(sys.modules[name])) except KeyError: pass
PORT = sys.argv[1] # find files and the tests in them mainsuite = unittest.TestSuite() for modulename in [ os.path.splitext(x)[0] for x in os.listdir(os.path.dirname(__file__) or '.') if x != __file__ and x.startswith("test") and x.endswith(".py") ]: try: module = __import__(modulename) except ImportError: print("skipping %s" % (modulename, )) else: module.PORT = PORT testsuite = unittest.findTestCases(module) print("found %s tests in %r" % (testsuite.countTestCases(), modulename)) mainsuite.addTest(testsuite) verbosity = 1 if '-v' in sys.argv[1:]: verbosity = 2 print('-' * 78) # run the collected tests testRunner = unittest.TextTestRunner(verbosity=verbosity) #~ testRunner = unittest.ConsoleTestRunner(verbosity=verbosity) result = testRunner.run(mainsuite) # set exit code accordingly to test results
def suite(): tests = unittest.TestSuite() for module in map(__import__, modules_to_test): tests.addTest(unittest.findTestCases(module)) return tests
def test_suite(): return unittest.findTestCases(sys.modules[__name__])
def suite7(): suite = unittest.findTestCases(test_1, prefix='test_b') return suite
def functionalTestSuite(): test_suite = unittest.TestSuite() test_suite.addTest(unittest.findTestCases(test_scripts)) return test_suite
def integrationTestSuite(): test_suite = unittest.TestSuite() test_suite.addTest(unittest.findTestCases(test_deployment)) return test_suite
def test_7_traversal(self): db = self.db db(5).under = 6 db(6).under = 7 db(7).under = 8 db(8).under = 9 db(9).under = 10 db(10).under = 11 db(11).under = 12 report( '7 step traversal', rps( iter((lambda: next( db(5).under.under.under.under.under.under.under())), 2))) def test_7_traversal_circle(self): db = self.db db(5).under = 6 db(6).under = 7 db(7).under = 5 report( '7 step traversal (circular)', rps( iter((lambda: next( db(5).under.under.under.under.under.under.under())), 2))) if __name__ == '__main__': unittest.TextTestRunner(verbosity=0).run( unittest.findTestCases(sys.modules[__name__]))
def main(): parser = OptionParser(usage="%prog [options] [files]") add = parser.add_option add("--conf", dest="conf", metavar="CONF", help="set the conf file") add("--profile", dest="profile", action="store_true", default=False, help="turn on hotshot profiling") add("--recurse", dest="recurse", action="store_true", default=False, help="recursively search directories on the command line") if os.name == 'nt': add("--disable-wildcards", dest="wildcards", action="store_false", default=True, help="do not resolve wildcards in the command line") else: add("--enable-wildcards", dest="wildcards", action="store_true", default=False, help="resolve wildcards in the command line") add("--dump", dest="dump", action="store_true", default=False, help="dump this script") add("--unittest", dest="unittest", action="store_true", default=False, help="run the python unittests") add("--quiet", dest="verbosity", action="store_const", const=0, help="minimal output") add("--verbose", dest="verbosity", action="store_const", const=2, help="verbose output") add("--nologo", dest="printlogo", action="store_false", default=True, help="suppress version information") add("--nofilelisting", dest="printlisting", action="store_false", default=True, help="suppress file names") add("--nosummary", dest="printsummary", action="store_false", default=True, help="suppress lint summary") add("--help:conf", dest="showdefaultconf", action="store_true", default=False, help="display the default configuration file") parser.set_defaults(verbosity=1) options, args = parser.parse_args() if len(sys.argv) == 1: parser.print_help() sys.exit() if options.showdefaultconf: print conf.DEFAULT_CONF sys.exit() if options.printlogo: printlogo() conf_ = conf.Conf() if options.conf: conf_.loadfile(options.conf) profile_func = _profile_disabled if options.profile: profile_func = _profile_enabled if options.unittest: suite = unittest.TestSuite() for module in [conf, htmlparse, jsparse, lint, util]: suite.addTest(unittest.findTestCases(module)) runner = unittest.TextTestRunner(verbosity=options.verbosity) runner.run(suite) paths = [] for recurse, path in conf_['paths']: paths.extend(_resolve_paths(path, recurse)) for arg in args: if options.wildcards: paths.extend(_resolve_paths(arg, options.recurse)) elif options.recurse and os.path.isdir(arg): paths.extend(_resolve_paths(os.path.join(arg, '*'), True)) else: paths.append(arg) if options.dump: profile_func(_dump, paths) else: profile_func(_lint, paths, conf_, options.printlisting) if options.printsummary: print '\n%i error(s), %i warnings(s)' % (_lint_results['errors'], _lint_results['warnings']) if _lint_results['errors']: sys.exit(3) if _lint_results['warnings']: sys.exit(1) sys.exit(0)