def __init__(self, command_line_args=None): """Initialize and run the test with the given command_line_args command_line_args will be passed to parser.parse_args """ command_line_args = command_line_args or sys.argv[1:] runner_action, test_path, test_runner_args, other_opts = parse_test_runner_command_line_args(command_line_args) self.setup_logging(other_opts) runner = TestRunner(**test_runner_args) bucket_overrides = {} if other_opts.bucket_overrides_file: bucket_overrides = get_bucket_overrides(other_opts.bucket_overrides_file) try: runner.discover(test_path, bucket=other_opts.bucket, bucket_count=other_opts.bucket_count, bucket_overrides=bucket_overrides) except test_discovery.DiscoveryError, e: self.log.error("Failure loading tests: %s", e) sys.exit(1)
def __init__(self, command_line_args=None): """Initialize and run the test with the given command_line_args command_line_args will be passed to parser.parse_args """ command_line_args = command_line_args or sys.argv[1:] runner_action, test_path, test_runner_args, other_opts = parse_test_runner_command_line_args(command_line_args) self.setup_logging(other_opts) runner = TestRunner(**test_runner_args) runner.discover(test_path, bucket=other_opts.bucket, bucket_count=other_opts.bucket_count) if runner_action == ACTION_LIST_SUITES: runner.list_suites() sys.exit(0) elif runner_action == ACTION_LIST_TESTS: runner.list_tests() sys.exit(0) elif runner_action == ACTION_RUN_TESTS: result = runner.run() sys.exit(not result)