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
Built Distribution
File details
Details for the file pytest_typechecker-0.3.3.tar.gz
.
File metadata
- Download URL: pytest_typechecker-0.3.3.tar.gz
- Upload date:
- Size: 3.3 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
Algorithm | Hash digest | |
---|---|---|
SHA256 | 58670da7c222694e5a85515aad4a3afb392109cc4eb9d8023281d2ff662d65c0 |
|
MD5 | 4dfe215f99e4e809447f6f1eff3e6f24 |
|
BLAKE2b-256 | 393338841b40b04234a285071666dfb0614f9b7cbfd8c7c18e547f503d65216b |
File details
Details for the file pytest_typechecker-0.3.3-py3-none-any.whl
.
File metadata
- Download URL: pytest_typechecker-0.3.3-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
Algorithm | Hash digest | |
---|---|---|
SHA256 | 172c99edab8b386bd1e50b6959a31d8edd38df09d29fb76682da92c78658ff71 |
|
MD5 | 51bd632c40b2aad106b2632e92b0a1ff |
|
BLAKE2b-256 | e7d4dfd2b38049cd4cd724a450340945817fe9b7e622c17350a894fc45154d45 |