Skip to main content

pytest plugin for writing tests for mypy plugins

Project description

mypy logo

PyTest plugin for testing mypy custom plugins

Build Status Checked with mypy

Examples of a test case:

[case my_test_case]
class MyClass:
    def method(self) -> str:
        pass
reveal_type(MyClass().method())  # E: Revealed type is 'builtins.str'
[CASE myTestCase]
[disable_cache]
[env DJANGO_SETTINGS_MODULE=settings]

print('hello, world)

[/CASE]

Options:

mypy-tests:
  --mypy-testing-base=MYPY_TESTING_BASE
                        Base directory for tests to use
  --mypy-ini-file=MYPY_INI_FILE
                        Which .ini file to use as a default config for tests

Documentation

General structure

Test case starts with the

[case my_test]

where my_test is a name of test. It could be camelCase or snake_case, no need for the test_ prefix. case keyword could be uppercased CASE too, if it helps readability.

Test case could optionally end with

[/case]

(or [/CASE]) if it helps readability.

All text between case delimiters is a code for a main.py file, except for special sections.

Sections

Format is

[SECTION_NAME( SECTION_ATTRS)?]

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-mypy-plugins-0.3.0.tar.gz (9.2 kB view details)

Uploaded Source

Built Distribution

pytest_mypy_plugins-0.3.0-py2.py3-none-any.whl (11.6 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file pytest-mypy-plugins-0.3.0.tar.gz.

File metadata

  • Download URL: pytest-mypy-plugins-0.3.0.tar.gz
  • Upload date:
  • Size: 9.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.6.2 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.6.8

File hashes

Hashes for pytest-mypy-plugins-0.3.0.tar.gz
Algorithm Hash digest
SHA256 308577ec9279ac90b3bb25f5349cd52ea7d6b8fa841e1652ccd070a29e12945b
MD5 8257c5c5aefbb074084171fd063935e3
BLAKE2b-256 e2c0cf5fb2ee6586475ebb59bc7989594e464a1c22d3ab21f955730b440a42e8

See more details on using hashes here.

File details

Details for the file pytest_mypy_plugins-0.3.0-py2.py3-none-any.whl.

File metadata

  • Download URL: pytest_mypy_plugins-0.3.0-py2.py3-none-any.whl
  • Upload date:
  • Size: 11.6 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.6.2 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.6.8

File hashes

Hashes for pytest_mypy_plugins-0.3.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 ac3ea236287261dc19d177bf5efc8c853f8576f5bcf16e40ef31691d7d2e1c39
MD5 e08b7621e403cecec8feb7ebf6fd80d6
BLAKE2b-256 469a08d67b0fd200941f5f37ba3ae5247a3126ef6d45119afc4650fa1af63aca

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