Skip to main content

pytest-typechecker

this is a plugin for pytest that allows you to create tests that verify how a type checker responds to your code.

This currently supports these type checkers:

  • pyright
  • mypy

File name format

this plugin looks for files starting with test and ending with types.py or types_xfail.py. for example test_something_types.py

global xfail

if you want to mark the hole test as xfail end it with types_xfail.py, for example.

# test_wrong_types_xfail.py

x: 123 = "abc"
y: str = 123

Only run specific checkers

if you include the name of a checker with _ around it only those checkers will be run. for example test_recursion_pyright_types.py

xfail specific checkers

if you provide a x before the checker name, it will be run in xfail mode. for example test_recursion_xmypy_types.py will run all checkers, but mark the mypy one as xfail

if you only want to run mypy and have it be xfail use this workaround: test_recursion_mypy_types_xfail.py

this can be combined, for example test_recursion_pyright_xmypy_types.py will run only pyright and mypy, but run mypy in xfail mode.

dont run specific checkers

if you provide a n before the checker name, it will not be run. for example test_recursion_nmypy_types.py will run all checkers, except mypy.

Release files for pytest-typechecker 0.3.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pytest-typechecker 0.3.3
File Size Uploaded
pytest_typechecker-0.3.3.tar.gz 3.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pytest-typechecker 0.3.3
File Interpreter ABI Platform
pytest_typechecker-0.3.3-py3-none-any.whl Python 3 none any Details

Total release size: 7.0 kB

Release files / pytest_typechecker-0.3.3.tar.gz

Download URL pytest_typechecker-0.3.3.tar.gz
Size 3.3 kB
Tags Source
SHA-256 checksum
How to use checksums
58670da7c222694e5a85515aad4a3afb392109cc4eb9d8023281d2ff662d65c0
BLAKE2b-256 checksum
How to use checksums
393338841b40b04234a285071666dfb0614f9b7cbfd8c7c18e547f503d65216b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.1.12 CPython/3.10.2 Linux/5.10.16.3-microsoft-standard-WSL2

Release files / pytest_typechecker-0.3.3-py3-none-any.whl

Download URL pytest_typechecker-0.3.3-py3-none-any.whl
Size 3.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
172c99edab8b386bd1e50b6959a31d8edd38df09d29fb76682da92c78658ff71
BLAKE2b-256 checksum
How to use checksums
e7d4dfd2b38049cd4cd724a450340945817fe9b7e622c17350a894fc45154d45
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.1.12 CPython/3.10.2 Linux/5.10.16.3-microsoft-standard-WSL2

Release history Release notifications | RSS feed

This release

0.3.3 This release

2 release files

0.3.2

2 release files

0.3.1

2 release files

0.3.0

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page