def run_test(schema: BaseSchema, endpoint: Endpoint, test: Union[(Callable, InvalidSchema)], checks: Iterable[Callable], results: TestResultSet, **kwargs: Any) -> Generator[(events.ExecutionEvent, None, None)]:
    'A single test run with all error handling needed.'
    result = TestResult(endpoint=endpoint)
    (yield events.BeforeExecution(results=results, schema=schema, endpoint=endpoint))
    hypothesis_output: List[str] = []
    try:
        if isinstance(test, InvalidSchema):
            status = Status.error
            result.add_error(test)
        else:
            with capture_hypothesis_output() as hypothesis_output:
                test(checks, result, **kwargs)
            status = Status.success
    except AssertionError:
        status = Status.failure
    except hypothesis.errors.Flaky:
        status = Status.error
        result.mark_errored()
        if result.checks:
            flaky_example = result.checks[(- 1)].example
        else:
            flaky_example = None
        result.add_error(hypothesis.errors.Flaky('Tests on this endpoint produce unreliable results: \nFalsified on the first call but did not on a subsequent one'), flaky_example)
    except hypothesis.errors.Unsatisfiable:
        status = Status.error
        result.add_error(hypothesis.errors.Unsatisfiable('Unable to satisfy schema parameters for this endpoint'))
    except KeyboardInterrupt:
        (yield events.Interrupted(results=results, schema=schema))
        return
    except Exception as error:
        status = Status.error
        result.add_error(error)
    result.seed = (getattr(test, '_hypothesis_internal_use_seed', None) or getattr(test, '_hypothesis_internal_use_generated_seed', None))
    results.append(result)
    (yield events.AfterExecution(results=results, schema=schema, endpoint=endpoint, status=status, hypothesis_output=hypothesis_output))
A single test run with all error handling needed.
def run_test(schema: BaseSchema, endpoint: Endpoint, test: Union[(Callable, InvalidSchema)], checks: Iterable[Callable], results: TestResultSet, **kwargs: Any) -> Generator[(events.ExecutionEvent, None, None)]:
    
    result = TestResult(endpoint=endpoint)
    (yield events.BeforeExecution(results=results, schema=schema, endpoint=endpoint))
    hypothesis_output: List[str] = []
    try:
        if isinstance(test, InvalidSchema):
            status = Status.error
            result.add_error(test)
        else:
            with capture_hypothesis_output() as hypothesis_output:
                test(checks, result, **kwargs)
            status = Status.success
    except AssertionError:
        status = Status.failure
    except hypothesis.errors.Flaky:
        status = Status.error
        result.mark_errored()
        if result.checks:
            flaky_example = result.checks[(- 1)].example
        else:
            flaky_example = None
        result.add_error(hypothesis.errors.Flaky('Tests on this endpoint produce unreliable results: \nFalsified on the first call but did not on a subsequent one'), flaky_example)
    except hypothesis.errors.Unsatisfiable:
        status = Status.error
        result.add_error(hypothesis.errors.Unsatisfiable('Unable to satisfy schema parameters for this endpoint'))
    except KeyboardInterrupt:
        (yield events.Interrupted(results=results, schema=schema))
        return
    except Exception as error:
        status = Status.error
        result.add_error(error)
    result.seed = (getattr(test, '_hypothesis_internal_use_seed', None) or getattr(test, '_hypothesis_internal_use_generated_seed', None))
    results.append(result)
    (yield events.AfterExecution(results=results, schema=schema, endpoint=endpoint, status=status, hypothesis_output=hypothesis_output))