Skip to main content

A pytest plugin to assert type annotations at runtime.

Project description

https://img.shields.io/pypi/v/pytest-fixture-typecheck https://img.shields.io/pypi/l/pytest-fixture-typecheck

pytest-fixture-typecheck is a pytest plugin that inserts runtime assertions that your fixture usages are properly typed.

Problem

Pytest fixtures are magic that mypy does not understand. This typechecks just fine:

@pytest.fixture
def myint():
    return 42

def test_basic(myint: str):
    assert myint == 42

This test passes but the type annotation is wrong.

With this pytest plugin it will pass typechecking all the same, but your test will fail at least.

If your tests do not have type annotations, this plugin does nothing. Use mypy to enforce that everything has type annotations.

License

Licensed under public domain.

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-fixture-typecheck-0.1.0.tar.gz (1.6 kB view hashes)

Uploaded Source

Built Distribution

pytest_fixture_typecheck-0.1.0-py3-none-any.whl (1.9 kB view hashes)

Uploaded Python 3

Supported by

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