def run_step(logger, iterations, restart_after_iteration, kwargs_extras, **kwargs): import wptrunner kwargs = copy.deepcopy(kwargs) if restart_after_iteration: kwargs["repeat"] = iterations else: kwargs["rerun"] = iterations kwargs["pause_after_test"] = False kwargs.update(kwargs_extras) def wrap_handler(x): x = LogLevelFilter(x, "WARNING") if not kwargs["verify_log_full"]: x = LogActionFilter(x, ["log", "process_output"]) return x initial_handlers = logger._state.handlers logger._state.handlers = [wrap_handler(handler) for handler in initial_handlers] log = io.BytesIO() # Setup logging for wptrunner that keeps process output and # warning+ level logs only logger.add_handler(StreamHandler(log, JSONFormatter())) wptrunner.run_tests(**kwargs) logger._state.handlers = initial_handlers logger._state.running_tests = set() logger._state.suite_started = False log.seek(0) results, inconsistent = process_results(log, iterations) return results, inconsistent, iterations