{"id":13690925,"url":"https://github.com/beartype/pytest-beartype","last_synced_at":"2026-05-04T19:10:18.444Z","repository":{"id":218411640,"uuid":"731977229","full_name":"beartype/pytest-beartype","owner":"beartype","description":"A pytest plugin to automatically run `beartype` on your test cases.","archived":false,"fork":false,"pushed_at":"2025-06-02T19:37:57.000Z","size":22,"stargazers_count":12,"open_issues_count":0,"forks_count":2,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-06-03T09:47:31.815Z","etag":null,"topics":["pytest","python3","runtime-typechecking"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/beartype.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2023-12-15T10:32:27.000Z","updated_at":"2025-06-02T19:38:01.000Z","dependencies_parsed_at":"2024-11-14T12:15:17.388Z","dependency_job_id":null,"html_url":"https://github.com/beartype/pytest-beartype","commit_stats":null,"previous_names":["tusharsadhwani/pytest-beartype"],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/beartype/pytest-beartype","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/beartype%2Fpytest-beartype","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/beartype%2Fpytest-beartype/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/beartype%2Fpytest-beartype/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/beartype%2Fpytest-beartype/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/beartype","download_url":"https://codeload.github.com/beartype/pytest-beartype/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/beartype%2Fpytest-beartype/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":268017031,"owners_count":24181659,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-07-31T02:00:08.723Z","response_time":66,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["pytest","python3","runtime-typechecking"],"created_at":"2024-08-02T17:00:36.583Z","updated_at":"2026-05-04T19:10:18.438Z","avatar_url":"https://github.com/beartype.png","language":"Python","funding_links":[],"categories":["👀 Status: *lookin' awesome*"],"sub_categories":["Development"],"readme":"\u003c!-- ---------------( LICENSE                              )--------------------\nCopyright (c) 2024-2025 Beartype authors.\nSee \"LICENSE\" for further details.\n\n--------------------( MAIN                                 )--------------------\n--\u003e\n\n![](https://raw.githubusercontent.com/beartype/beartype-assets/main/banner/logo.png)\n\n[![tests](https://github.com/beartype/pytest-beartype/actions/workflows/python_test.yml/badge.svg)](https://github.com/beartype/pytest-beartype/actions/workflows/python_test.yml)\n\n# `pytest-beartype`: Type-check All the [Pytest][] Things\n\n\u003c!-- FIXME: Also document below how users can *DISABLE* this plugin: e.g.,\n  # In \"pytest.ini\":\n  addopts = -p no:beartype\n--\u003e\n\n`pytest-beartype` is a [pytest][] plugin type-checking tests, fixtures, and your\npackages at test-time with [@beartype][]:\n\n\u003e The unbearably fast near-real-time pure-Python runtime-static type-checker.\n\n`pytest-beartype` is [portably implemented][codebase] in [Python 3][Python],\n[continuously stress-tested][tests] via [GitHub Actions][] **×** [tox][] **×**\n[pytest][], and [permissively distributed](#license) under the [MIT license][].\n`pytest-beartype` has only two runtime dependencies ([pytest][] and\n[@beartype][], unsurprisingly) and *no* test-time dependencies.\n`pytest-beartype` supports *all* [actively developed Python versions][Python\nstatus] and *all* [Python package managers](#installation).\n\n## Installation\n\n`pytest-beartype` supports your favourite Python package managers! It better.\n\n* Via [uv][], the newest upstart to emerge victorious in the battle of wills:\n\n  ```bash\n  uv add pytest-beartype       # \u003c-- by the power of ultraviolet radiation\n  ```\n\n* Via [pip][], the once-great venerable master now fallen on hard times:\n\n  ```bash\n  pip install pytest-beartype  # \u003c-- sometimes the old ways are still okay\n  ```\n\n`pytest-beartype`: QA without doing anything.\n\n## Usage\n\n`pytest-beartype` does *nothing* by default. This plugin only type-checks your\nexternal packages, your [pytest][] tests, and your [pytest][] fixtures when you\ntell it to – for your safety and the safety of the code you test:\n\n* Type-check everything at the command line! `(◕‿◕✿)`\n\n  ```bash\n  $ pytest --beartype-tests --beartype-fixtures \\\n      --beartype-packages=\"my_package,your_package\" \\\n      --beartype-skip-packages=\"my_package.my_bad_submodule,your_bad_package\"\n  ```\n\n* Type-check everything from [`pyproject.toml`][pyproject.toml]! `(◡‿◡✿)`\n\n  ```toml\n  [tool.pytest.ini_options]\n  beartype_tests = true\n  beartype_fixtures = true\n  beartype_packages = [\"my_package\", \"your_package\"]\n  beartype_skip_packages = [\"my_package.my_bad_submodule\", \"your_bad_package\"]\n  ```\n\n* Type-check everything from [`pytest.ini`][pytest.ini]! `(❀◦‿◦)`\n\n  ```ini\n  [pytest]\n  beartype_tests = true\n  beartype_fixtures = true\n  beartype_packages = my_package your_package\n  beartype_skip_packages = my_package.my_bad_submodule your_bad_package\n  ```\n\nWould you like to know more? Continue reading for details that may bore you.\n\n## Features\n\n`pytest-beartype` configurably type-checks any combination of [pytest][] tests,\n[pytest][] fixtures, and one or more arbitrary [Python][] packages through\nplugin-specific options either temporarily passed to the [`pytest`\ncommand][pytest command] *or* permanently set from within project-specific\n[`pyproject.toml`][pyproject.toml] and [`pytest.ini`][pytest.ini] configuration\nfiles:\n\n| **Type-check**    | **CLI Option**                                   | **`pyproject.toml` Option**                          | **`pytest.ini` Option**                          |\n|-------------------|--------------------------------------------------|------------------------------------------------------|--------------------------------------------------|\n| *All* tests       | `--beartype-tests`                               | `beartype_tests = true`                              | `beartype_tests = true`                          |\n| *All* fixtures    | `--beartype-fixtures`                            | `beartype_fixtures = true`                           | `beartype_fixtures = true`                       |\n| One package       | `--beartype-packages=my_package`                 | `beartype_packages = [\"my_package\"]`                 | `beartype_packages = my_package`                 |\n| Multiple packages | `--beartype-packages=\"my_package,your_package\"`  | `beartype_packages = [\"my_package\", \"your_package\"]` | `beartype_packages = my_package your_package`    |\n| Exclude packages  | `--beartype-skip-packages=my_package.bad_module` | `beartype_skip_packages = [\"my_package.bad_module\"]` | `beartype_skip_packages = my_package.bad_module` |\n\nWould you like to know more? No? Oh. Okay... **wait.** What? Really? You really\nwould like to no more? You should be bored out of your mind already! How can you\nstill be reading this? How can I even still be typing this!? 😮\n\n`pytest-beartype`: *Let's get this QA party started.*\n\n### Type-check Tests\n\nBy default, `pytest-beartype` type-checks *no* tests inside your test suite.\nConfigure `pytest-beartype` to type-check *all* your tests (including *all*\nparameters and fixtures passed to tests) inside your test suite:\n\n* By passing the `--beartype-tests` option to the [`pytest`\n  command][pytest command]:\n\n  ```bash\n  pytest --beartype-tests\n  ```\n\n* By setting the `beartype_tests = true` option in your\n  [`pyproject.toml` file][pyproject.toml]:\n\n  ```toml\n  [tool.pytest.ini_options]\n  beartype_tests = true\n  ```\n\n* By setting the `beartype_tests = true` option in your\n  [`pytest.ini` file][pytest.ini]:\n\n  ```ini\n  beartype_tests = true\n  ```\n\n`pytest-beartype`: QA is made of this.\n\n### Type-check Fixtures\n\nBy default, `pytest-beartype` type-checks *no* fixtures inside your test suite.\nConfigure `pytest-beartype` to type-check *all* your fixtures (including *all*\nparameters passed to and values returned from those fixtures as well as other\nfixtures required by those fixtures) inside your test suite:\n\n* By passing the `--beartype-fixtures` option to the [`pytest`\n  command][pytest command]:\n\n  ```bash\n  pytest --beartype-fixtures\n  ```\n\n* By setting the `beartype_fixtures = true` option in your\n  [`pyproject.toml` file][pyproject.toml]:\n\n  ```toml\n  [tool.pytest.ini_options]\n  beartype_fixtures = true\n  ```\n\n* By setting the `beartype_fixtures = true` option in your\n  [`pytest.ini` file][pytest.ini]:\n\n  ```ini\n  beartype_fixtures = true\n  ```\n\n`pytest-beartype`: Who is `pytest` to disagree?\n\n### Type-check Packages\n\nBy default, `pytest-beartype` type-checks *no* packages outside your test suite.\nIf your packages are already internally type-checked by [@beartype][], no\nproblem. Your packages *are* internally type-checked by [@beartype][], aren't\nthey!? Uh oh. 😫\n\nMaybe... *not*. Maybe you have justifiable usability or efficiency concerns.\nMaybe you prefer to only conditionally type-check your packages by [@beartype][]\nwhile running tests and *only* while running tests. Maybe this is you. Fear not,\nfellow QA person! `pytest-beartype` is here to type-check your dreams.\n\nConfigure `pytest-beartype` to either...\n\n#### Type-check a Single Package\n\nType-check a **single package** (e.g., yours) while running tests:\n\n* By passing the `--beartype-packages={package_name}` option to the [`pytest`\n  command][pytest command]:\n\n  ```bash\n  pytest --beartype-packages=muh_package_name\n  ```\n\n* By setting the `beartype_packages = [\"{package_name}\"]` option in your\n  [`pyproject.toml` file][pyproject.toml]:\n\n  ```toml\n  [tool.pytest.ini_options]\n  beartype_packages = [\"muh_package_name\"]\n  ```\n\n* By setting the `beartype_packages = {package_name}` option in your\n  [`pytest.ini` file][pytest.ini]:\n\n  ```ini\n  beartype_packages = muh_package_name\n  ```\n\n`pytest-beartype`: Because life's already too complicated.\n\n#### Type-check Two or More Packages\n\nType-check **two or more packages** (e.g., yours) while running tests:\n\n* By passing the\n  `--beartype-packages=\"{first_package_name},...,{last_package_name}\"` option\n  as a comma-delimited list to the [`pytest` command][pytest command]:\n\n  ```bash\n  pytest --beartype-packages='muh_package_name,muh_other_package_name'\n  ```\n\n* By setting the `beartype_packages = [\"{first_package_name}\", ...,\n  \"{last_package_name}\"]` option as a comma-delimited list in your\n  [`pyproject.toml` file][pyproject.toml]:\n\n  ```toml\n  [tool.pytest.ini_options]\n  beartype_packages = [\"muh_package_name\", \"muh_other_package_name\"]\n  ```\n\n* By setting the `beartype_packages = {first_package_name} ...\n  {last_package_name}` option as a **whitespace**-delimited list in your\n  [`pytest.ini` file][pytest.ini]:\n\n  ```ini\n  beartype_packages = muh_package_name muh_other_package_name\n  ```\n\n`pytest-beartype`: Because code's already too complicated, too.\n\n#### Type-check All Packages\n\nType-check **all packages** transitively imported anywhere while running tests.\nType-check your entire app stack at test time! Only the brave, the foolhardy,\nand the desperate need apply:\n\n* By passing the `--beartype-packages=\"*\"` option to the [`pytest`\n  command][pytest command].\n\n  ```bash\n  pytest --beartype-packages='*'\n  ```\n\n  \u003e **CAUTION:** The `\"*\"` character should typically be single- or\n  \u003e double-quoted to prevent your shell from erroneously expanding that as a\n  \u003e pathname glob.\n\n* By setting the `beartype_packages = [\"*\"]` option in your [`pyproject.toml`\n  file][pyproject.toml]:\n\n  ```toml\n  [tool.pytest.ini_options]\n  beartype_packages = [\"*\"]\n  ```\n\n* By setting the `beartype_packages = *` option in your [`pytest.ini`\n  file][pytest.ini]:\n\n  ```ini\n  beartype_packages = *\n  ```\n\n\u003e **CAUTION:** You may need to omit problematic packages by also passing the\n\u003e `--beartype-skip-packages` option to the [`pytest` command][pytest command]\n\u003e command *or* setting the `beartype_skip_packages` option in your\n\u003e [`pyproject.toml`][pyproject.toml] or [`pytest.ini`][pytest.ini] files. See\n\u003e below for further commentary that will bore you into oblivion.\n\n### Avoid Type-checking Some Packages\n\nBy default, `pytest-beartype` type-checks *all* subpackages and submodules of\npackages explicitly listed by passing the `--beartype-packages` option to the\n[`pytest` command][pytest command] command *or* setting the `beartype_packages`\noption in your [`pyproject.toml`][pyproject.toml] or [`pytest.ini`][pytest.ini]\nfiles.\n\nIdeally, that's fine. Ideally, your packages are all type-checkable in entirety.\nBut what if that's not fine? This is the real world over here. What if you're\ntype-checking *all* packages in your app stack with `--beartype-packages=\"*\"`,\nfor example, and one or more of those packages (or their subpackages or\nsubmodules) fail type-checking? What then, huh?\n\nConfigure `pytest-beartype` to *not* type-check one or more of these\n(sub)packages or (sub)modules while running tests:\n\n* By passing the\n  `--beartype-skip-packages=\"{first_package_name},...,{last_package_name}\"`\n  option to the [`pytest` command][pytest command].\n\n  ```bash\n  pytest --beartype-skip-packages=\"muh_package.muh_bad_submodule,muh_bad_package\"\n  ```\n\n* By setting the `beartype_skip_packages = [\"{first_package_name}\", ...,\n  \"{last_package_name}\"]` option in your [`pyproject.toml`\n  file][pyproject.toml]:\n\n  ```toml\n  [tool.pytest.ini_options]\n  beartype_skip_packages = [\"muh_package.muh_bad_submodule\", \"muh_bad_package\"]\n  ```\n\n* By setting the `beartype_skip_packages = {first_package_name} ...\n  {last_package_name}` option as a **whitespace**-delimited list in your\n  [`pytest.ini` file][pytest.ini]:\n\n  ```ini\n  beartype_skip_packages = muh_package.muh_bad_submodule muh_bad_package\n  ```\n\n`pytest-beartype`: That'll do, GitHub. That'll do.\n\n## License\n\n`pytest-beartype` is [open-source software released][license] under the\n[permissive MIT license][MIT license].\n\n## Security\n\n`pytest-beartype` encourages security researchers, institutes, and concerned\nnetizens to [responsibly disclose security vulnerabilities as GitHub-originated\nSecurity Advisories][security] – published with full acknowledgement in the\npublic [GitHub Advisory Database][].\n\n\u003c!-- ---------------( LINKS ~ self                         )---------------- --\u003e\n[codebase]: https://github.com/beartype/pytest-beartype/tree/main/pytest_beartype\n[license]: ./LICENSE\n[security]: https://github.com/beartype/pytest-beartype/blob/main/.github/SECURITY.md\n[tests]: https://github.com/beartype/beartype/actions?workflow=tests\n\n\u003c!-- ---------------( LINKS ~ other                        )---------------- --\u003e\n[@beartype]: https://github.com/beartype/beartype\n[GitHub Actions]: https://github.com/features/actions\n[GitHub Advisory Database]: https://github.com/advisories\n[MIT license]: https://opensource.org/licenses/MIT\n[pyproject.toml]: https://packaging.python.org/en/latest/guides/writing-pyproject-toml\n[Pytest]: https://docs.pytest.org\n[pytest]: https://docs.pytest.org\n[pytest command]: https://docs.pytest.org/en/stable/how-to/usage.html\n[Python]: https://www.python.org\n[Python status]: https://devguide.python.org/versions/#versions\n[pytest.ini]: https://docs.pytest.org/en/stable/reference/customize.html\n[pip]: https://packaging.python.org/en/latest/tutorials/installing-packages\n[tox]: https://tox.readthedocs.io\n[uv]: https://docs.astral.sh/uv\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbeartype%2Fpytest-beartype","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbeartype%2Fpytest-beartype","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbeartype%2Fpytest-beartype/lists"}