def main():
log.configure(level=logging.DEBUG)<EOL>conf_file = DEFAULT_TEST_CONF_FILE<EOL>conf_string = pkgutil.get_data(__name__, conf_file)<EOL>decoder = json.JSONDecoder(strict=False)<EOL>conf = decoder.decode(conf_string)<EOL>args = dict()<EOL>home_directory = os.path.expanduser("<STR_LIT>")<EOL>args['<STR_LIT>'] = conf['<STR_LIT>']<EOL>args['<STR_LIT>'] = conf['<STR_LIT>']['<STR_LIT>']<EOL>args['<STR_LIT>'] = conf['<STR_LIT>']['<STR_LIT>']<EOL>args['<STR_LIT>'] = os.path.join(<EOL>home_directory,<EOL>"<STR_LIT>",<EOL>"<STR_LIT>",<EOL>conf['<STR_LIT>'],<EOL>getpass.getuser(),<EOL>args['<STR_LIT>']<EOL>)<EOL>args['<STR_LIT>'] = os.path.expanduser(conf['<STR_LIT>'])<EOL>args['<STR_LIT>'] = os.path.expanduser(conf['<STR_LIT>'])<EOL>args['<STR_LIT>'] = _random_port()<EOL>args['<STR_LIT>'] = os.path.join(args['<STR_LIT>'], conf['<STR_LIT>']['<STR_LIT>'])<EOL>args['<STR_LIT>'] = os.path.join(args['<STR_LIT>'], conf['<STR_LIT>']['<STR_LIT>'])<EOL>args['<STR_LIT>'] = conf['<STR_LIT>']<EOL>test_classes = TEST_CLASSES<EOL>if len(sys.argv) > <NUM_LIT:1>:<EOL><INDENT>first_arg = sys.argv[<NUM_LIT:1>]<EOL>class_tokens = first_arg.split("<STR_LIT:.>")<EOL>if first_arg == "<STR_LIT>" or len(class_tokens) < <NUM_LIT:2>:<EOL><INDENT>usage()<EOL><DEDENT>import importlib<EOL>package_tokens = class_tokens[:-<NUM_LIT:1>]<EOL>test_class = class_tokens[-<NUM_LIT:1>]<EOL>if len(package_tokens) == <NUM_LIT:1>: <EOL><INDENT>test_module = "<STR_LIT>" + package_tokens[<NUM_LIT:0>]<EOL><DEDENT>else:<EOL><INDENT>test_module = '<STR_LIT:.>'.join(package_tokens)<EOL><DEDENT>logging.info("<STR_LIT>", test_module)<EOL>logging.info("<STR_LIT>", test_class)<EOL>test_classes = [getattr(importlib.import_module(test_module), test_class)]<EOL><DEDENT>start_time = time.time()<EOL>(successes, failures) = run_tests(test_classes, args)<EOL>elapsed_time = time.time() - start_time<EOL>total = len(failures) + len(successes)<EOL>if not failures:<EOL><INDENT>logging.info("<STR_LIT>", len(successes))<EOL>logging.info("<STR_LIT>", elapsed_time)<EOL>sys.exit(<NUM_LIT:0>)<EOL><DEDENT>else:<EOL><INDENT>logging.error("<STR_LIT>", len(failures), total)<EOL>for test in failures:<EOL><INDENT>logging.error("<STR_LIT>", test)<EOL><DEDENT>sys.exit(<NUM_LIT:1>)<EOL><DEDENT>
main