-
-
Save cneill/55534fc98717104d0b88b1fb8362766a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@classmethod | |
def run(cls): | |
global result | |
test_id = 1000 | |
try: | |
try: | |
syntribos.config.register_opts() | |
CONF(sys.argv[1:], | |
default_config_files=cls.get_default_conf_files()) | |
logging.basicConfig(filename=cls.get_log_file_name(), | |
level=logging.DEBUG) | |
except Exception as exc: | |
syntribos.config.handle_config_exception(exc) | |
cls.print_symbol() | |
# 2 == higher verbosity, 1 == normal | |
verbosity = 0 | |
if not CONF.outfile: | |
decorator = unittest.runner._WritelnDecorator(sys.stdout) | |
else: | |
decorator = unittest.runner._WritelnDecorator( | |
open(CONF.outfile, 'w')) | |
result = IssueTestResult(decorator, True, verbosity) | |
start_time = time.time() | |
print("\nRunning Tests...:") | |
for file_path, req_str in CONF.syntribos.templates: | |
print syntribos.SEP | |
print file_path | |
print syntribos.SEP | |
print("\n ID\t\tTest Name\t\t\t\t\t\tProgress") | |
for test_name, test_class in cls.get_tests( | |
CONF.test_types, CONF.excluded_types): | |
test_id += 5 | |
log_string = "[{test_id}] : {name}".format( | |
test_id=colored(test_id, 'green'), | |
name=test_name.replace("_", " ").capitalize()) | |
log_string = log_string.ljust(60) | |
LOG.debug(log_string) | |
test_class.send_init_request(file_path, req_str) | |
test_cases = list( | |
test_class.get_test_cases(file_path, req_str)) | |
if len(test_cases) > 0: | |
bar = Bar(log_string, max=len(test_cases), | |
suffix='%(percent).1f%% - %(avg)fs') | |
for test in test_cases: | |
if test: | |
cls.run_test(test, result, CONF.dry_run) | |
bar.next() | |
bar.finish() | |
print(syntribos.SEP) | |
print("\nResults...:") | |
cls.print_result(result, start_time) | |
except KeyboardInterrupt: | |
cls.print_result(result, start_time) | |
print("Keyboard interrupt, exiting...") | |
exit(0) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment