コード例 #1
0
def main():
    args = parse_arguments()

    set_log_mode(args)
    tests_config_path = args.config
    target_config_path = args.target

    if args.plugin:
        for plugin_dir in args.plugin:
            load_plugin_modules(plugin_dir)

    try:
        command = args.command
        if command == RUN_COMMAND:
            success = Pluma.execute_run(tests_config_path, target_config_path)
            exit(0 if success else 1)
        elif command == CHECK_COMMAND:
            Pluma.execute_run(tests_config_path,
                              target_config_path,
                              check_only=True)
        elif command == TESTS_COMMAND:
            Pluma.execute_tests(tests_config_path, target_config_path)
        elif command == CLEAN_COMMAND:
            Pluma.execute_clean(args.force)
        elif command == VERSION_COMMAND:
            log.log(Pluma.version(), level=LogLevel.IMPORTANT)
    except TestsConfigError as e:
        log.error([
            f'Error while parsing the tests configuration ({tests_config_path}):',
            str(e)
        ])
        exit(-2)
    except TargetConfigError as e:
        log.error([
            f'Error while parsing the target configuration ({target_config_path}):',
            str(e)
        ])
        exit(-3)
    except TestsBuildError as e:
        log.error(['Error while building tests:', str(e)])
        exit(-4)
    except Exception as e:
        if log.mode in [LogMode.VERBOSE, LogMode.DEBUG]:
            traceback.print_exc()
        log.error(repr(e))
        exit(-1)
コード例 #2
0
def run_all(test_file: str, target_file: str):
    test_file_path = path.join(config_file_path(test_file))
    target_file_path = path.join(config_file_path(target_file))

    Pluma.execute_tests(test_file_path, target_file_path)
    Pluma.execute_run(test_file_path, target_file_path, check_only=True)