Skip to main content

Run type checkers on specified test files

Project description

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pytest_typechecker-0.3.0.tar.gz (3.2 kB view details)

Uploaded Source

Built Distribution

pytest_typechecker-0.3.0-py3-none-any.whl (3.7 kB view details)

Uploaded Python 3

File details

Details for the file pytest_typechecker-0.3.0.tar.gz.

File metadata

  • Download URL: pytest_typechecker-0.3.0.tar.gz
  • Upload date:
  • Size: 3.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.12 CPython/3.10.2 Linux/5.10.16.3-microsoft-standard-WSL2

File hashes

Hashes for pytest_typechecker-0.3.0.tar.gz
Algorithm Hash digest
SHA256 bee06c3a7af8cd5e5f00c45c5d9fb9ce35b24404733f21a65cda8975f95a5f44
MD5 03d5aec0016c3d38b4c8882e8d03c4a3
BLAKE2b-256 42beb266b71ac7ea01fc4e40437ebd903c36f65e1f060fe85faf50c3a575db65

See more details on using hashes here.

File details

Details for the file pytest_typechecker-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: pytest_typechecker-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 3.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.12 CPython/3.10.2 Linux/5.10.16.3-microsoft-standard-WSL2

File hashes

Hashes for pytest_typechecker-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 db2c21f0165f5107ea7e6e5a3812fa3bcedfda728f9cccc179ececa9a4e240fc
MD5 1a19e47408f74b80139c9f7e39e35552
BLAKE2b-256 fbe9f2bc2573b941e7069573471a70166bd21a771e72d78f0c2b8ce86ad8fb14

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page