{"library":"pytest-mypy-plugins","title":"pytest-mypy-plugins","description":"pytest-mypy-plugins is a pytest plugin designed for writing tests for mypy plugins, stubs, and type definitions. It allows developers to verify the correctness of their type annotations and mypy plugin behavior directly within their pytest test suite. The library is actively maintained, with releases as needed, and the current version is 4.0.1.","language":"python","status":"active","last_verified":"Sun May 17","install":{"commands":["pip install pytest-mypy-plugins"],"cli":null},"imports":["No explicit import usually needed, automatically discovered by pytest."],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"# Save as my_module.py\ndef add(a: int, b: int) -> int:\n    return a + b\n\n# Save as test_types.yml in a directory like 'typesafety/'\n- case: correct_addition\n  main: |\n    from my_module import add\n    result = add(1, 2)\n    reveal_type(result) # N: Revealed type is 'builtins.int'\n\n- case: incorrect_addition_type\n  main: |\n    from my_module import add\n    add(1, '2') # E: Argument 2 to \"add\" has incompatible type \"str\"; expected \"int\" [arg-type]\n\n# To run tests, simply execute pytest in your terminal from the project root:\n# pytest","lang":"python","description":"Create a Python file (`my_module.py`) with code to be type-checked, and a YAML file (`test_types.yml`) defining test cases. Each `case` block in the YAML file contains `main` (Python code) and uses `# N:` for expected `reveal_type` output or `# E:` for expected mypy error messages. The plugin automatically discovers and runs these tests when `pytest` is executed.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":{"tag":null,"tag_description":null,"last_tested":"2026-05-17","installed_version":"3.2.0","pypi_latest":"4.0.3","is_stale":true,"summary":{"python_range":"3.10–3.9","success_rate":100,"avg_install_s":6.7,"avg_import_s":null,"wheel_type":"wheel"},"results":[{"runtime":"python:3.10-alpine","python_version":"3.10","os_libc":"alpine (musl)","variant":"pytest-mypy-plugins","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"broken","install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":"104.1M"},{"runtime":"python:3.10-slim","python_version":"3.10","os_libc":"slim (glibc)","variant":"pytest-mypy-plugins","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"broken","install_time_s":7.2,"import_time_s":null,"mem_mb":null,"disk_size":"104M"},{"runtime":"python:3.11-alpine","python_version":"3.11","os_libc":"alpine (musl)","variant":"pytest-mypy-plugins","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"broken","install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":"112.0M"},{"runtime":"python:3.11-slim","python_version":"3.11","os_libc":"slim (glibc)","variant":"pytest-mypy-plugins","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"broken","install_time_s":6.5,"import_time_s":null,"mem_mb":null,"disk_size":"112M"},{"runtime":"python:3.12-alpine","python_version":"3.12","os_libc":"alpine (musl)","variant":"pytest-mypy-plugins","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"broken","install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":"103.5M"},{"runtime":"python:3.12-slim","python_version":"3.12","os_libc":"slim (glibc)","variant":"pytest-mypy-plugins","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"broken","install_time_s":5.8,"import_time_s":null,"mem_mb":null,"disk_size":"103M"},{"runtime":"python:3.13-alpine","python_version":"3.13","os_libc":"alpine (musl)","variant":"pytest-mypy-plugins","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"broken","install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":"103.5M"},{"runtime":"python:3.13-slim","python_version":"3.13","os_libc":"slim (glibc)","variant":"pytest-mypy-plugins","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"broken","install_time_s":5.8,"import_time_s":null,"mem_mb":null,"disk_size":"103M"},{"runtime":"python:3.9-alpine","python_version":"3.9","os_libc":"alpine (musl)","variant":"pytest-mypy-plugins","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"broken","install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":"95.6M"},{"runtime":"python:3.9-slim","python_version":"3.9","os_libc":"slim (glibc)","variant":"pytest-mypy-plugins","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"broken","install_time_s":8.2,"import_time_s":null,"mem_mb":null,"disk_size":"95M"}]}}