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 details)

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

Details for the file pytest-fixture-typecheck-0.1.0.tar.gz.

File metadata

  • Download URL: pytest-fixture-typecheck-0.1.0.tar.gz
  • Upload date:
  • Size: 1.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.6.4 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.9.1

File hashes

Hashes for pytest-fixture-typecheck-0.1.0.tar.gz
Algorithm Hash digest
SHA256 9b0d36c3555c7599238da59d95309580b113d1e74f432baf3bdb433c7fdef49a
MD5 97c82dd51f8d66d2647c4d6fb94a6923
BLAKE2b-256 8391dd662f5079cc03e8fba6c26781967bb299a60694da35e059e215c3da946e

See more details on using hashes here.

File details

Details for the file pytest_fixture_typecheck-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: pytest_fixture_typecheck-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 1.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.6.4 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.9.1

File hashes

Hashes for pytest_fixture_typecheck-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 eb09c8798935e26047547f6a43b13fd64658a086e8d3c1bffa46a6d7d7796f3b
MD5 2879daaa910d481b6f85ff81ef82d54a
BLAKE2b-256 89ec7f2231d8b19a82a5df2e1018331951d4fc5bd44b12d6cfb5b90a46627206

See more details on using hashes here.

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