Runners
Expectations
- class pytest_typing_runner.expectations.RunResult(*, exit_code: int, stdout: str, stderr: str)
Holds the result from running a type checker
Implements
pytest_typing_runner.protocols.RunResult- Parameters:
exit_code – The return code from running the type checker
stdout – A string of the stdout from running the type checker
stderr – A string of the stderr from running the type checker
- class pytest_typing_runner.expectations.Expectations(*, expect_fail: bool = False, expect_stderr: str = '', expect_notices: ~pytest_typing_runner.protocols.ProgramNotices = <factory>)
Used to check the result of running a type checker against some expectation.
Implements
pytest_typing_runner.protocols.Expectations- Parameters:
expect_fail – Whether we expect the run to have failed.
expect_stderr – What we expect in the stderr
expect_notices – The notices expected from running the type checker
- check(*, notice_checker: NoticeChecker[T_Scenario]) None
Used to pass in the epxected notices to the notice checker and the check the stderr and exit_code on the run result.
- Parameters:
notice_checker – The object that holds the run result, runner that was used, and the logic for checking the notices in the run result.
- Raises:
AssertionError – If stderr on the result is different than expected
AssertionError – If exit code is non zero when we don’t expect fail or if the exit code is 0 when we do expect failure
- classmethod setup_for_success(*, options: RunOptions[T_Scenario]) type[Self]
Handy implementation of
pytest_typing_runner.protocols.ExpectationsSetup
- pytest_typing_runner.expectations.compare_notices(diff: DiffNotices) None
Create a diff message and raise it inside an
AssertionErrorif there is a difference present in the provided diff.