{"id":13606561,"url":"https://github.com/m-burst/flake8-pytest-style","last_synced_at":"2026-04-06T00:05:25.283Z","repository":{"id":38315415,"uuid":"187920593","full_name":"m-burst/flake8-pytest-style","owner":"m-burst","description":"A flake8 plugin checking common style issues or inconsistencies with pytest-based tests.","archived":false,"fork":false,"pushed_at":"2025-01-10T15:57:24.000Z","size":703,"stargazers_count":228,"open_issues_count":35,"forks_count":17,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-11T10:23:49.776Z","etag":null,"topics":["flake8","flake8-extensions","flake8-plugin","flake8-plugins","pytest","python3"],"latest_commit_sha":null,"homepage":null,"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/m-burst.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}},"created_at":"2019-05-21T22:10:45.000Z","updated_at":"2025-03-24T11:21:19.000Z","dependencies_parsed_at":"2022-08-03T04:16:03.575Z","dependency_job_id":"356173ef-4ca4-4d67-b806-0130384b00b4","html_url":"https://github.com/m-burst/flake8-pytest-style","commit_stats":{"total_commits":234,"total_committers":12,"mean_commits":19.5,"dds":0.5470085470085471,"last_synced_commit":"3d042b6d097a052aac4a16cff2960782946efff9"},"previous_names":[],"tags_count":30,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/m-burst%2Fflake8-pytest-style","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/m-burst%2Fflake8-pytest-style/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/m-burst%2Fflake8-pytest-style/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/m-burst%2Fflake8-pytest-style/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/m-burst","download_url":"https://codeload.github.com/m-burst/flake8-pytest-style/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248539867,"owners_count":21121250,"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","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":["flake8","flake8-extensions","flake8-plugin","flake8-plugins","pytest","python3"],"created_at":"2024-08-01T19:01:10.258Z","updated_at":"2026-04-06T00:05:25.275Z","avatar_url":"https://github.com/m-burst.png","language":"Python","funding_links":[],"categories":["Python","Topics Index","Testing"],"sub_categories":["Code Quality and Linting"],"readme":"# flake8-pytest-style\n\n[![pypi](https://badge.fury.io/py/flake8-pytest-style.svg)](https://pypi.org/project/flake8-pytest-style)\n[![Python: 3.10+](https://img.shields.io/badge/Python-3.10+-blue.svg)](https://pypi.org/project/flake8-pytest-style)\n[![Downloads](https://img.shields.io/pypi/dm/flake8-pytest-style.svg)](https://pypistats.org/packages/flake8-pytest-style)\n[![Build Status](https://github.com/m-burst/flake8-pytest-style/actions/workflows/ci.yml/badge.svg?branch=master)](https://github.com/m-burst/flake8-pytest-style/actions/workflows/ci.yml)\n[![Code coverage](https://codecov.io/gh/m-burst/flake8-pytest-style/branch/master/graph/badge.svg)](https://codecov.io/gh/m-burst/flake8-pytest-style)\n[![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](https://en.wikipedia.org/wiki/MIT_License)\n[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/ambv/black)\n\n## Description\n\nA `flake8` plugin checking common style issues or inconsistencies with `pytest`-based tests.\n\nCurrently the following errors are reported:\n\n| Code    | Description |\n| ------- | ----------- |\n| [PT001] | use @pytest.fixture over @pytest.fixture() \u003cbr\u003e (configurable by `pytest-fixture-no-parentheses`) |\n| [PT002] | configuration for fixture '{name}' specified via positional args, use kwargs |\n| [PT003] | scope='function' is implied in @pytest.fixture() |\n| [PT004] | fixture '{name}' does not return anything, add leading underscore |\n| [PT005] | fixture '{name}' returns a value, remove leading underscore |\n| [PT006] | wrong name(s) type in @pytest.mark.parametrize, expected {expected_type} \u003cbr\u003e (configurable by `pytest-parametrize-names-type`) |\n| [PT007] | wrong values type in @pytest.mark.parametrize, expected {expected_type} \u003cbr\u003e (configurable by `pytest-parametrize-values-type` and `pytest-parametrize-values-row-type`) |\n| [PT008] | use return_value= instead of patching with lambda |\n| [PT009] | use a regular assert instead of unittest-style '{assertion}' |\n| [PT010] | set the expected exception in pytest.raises() |\n| [PT011] | pytest.raises({exception}) is too broad, set the match parameter or use a more specific exception \u003cbr\u003e (configurable by `pytest-raises-require-match-for`) |\n| [PT012] | pytest.raises() block should contain a single simple statement |\n| [PT013] | found incorrect import of pytest, use simple 'import pytest' instead |\n| [PT014] | found duplicate test cases {indexes} in @pytest.mark.parametrize |\n| [PT015] | assertion always fails, replace with pytest.fail() |\n| [PT016] | no message passed to pytest.fail() |\n| [PT017] | found assertion on exception {name} in except block, use pytest.raises() instead |\n| [PT018] | assertion should be broken down into multiple parts |\n| [PT019] | fixture {name} without value is injected as parameter, use @pytest.mark.usefixtures instead |\n| [PT020] | @pytest.yield_fixture is deprecated, use @pytest.fixture |\n| [PT021] | use yield instead of request.addfinalizer |\n| [PT022] | no teardown in fixture {name}, use return instead of yield |\n| [PT023] | use @pytest.mark.foo over @pytest.mark.foo() \u003cbr\u003e (configurable by `pytest-mark-no-parentheses`) |\n| [PT024] | pytest.mark.asyncio is unnecessary for fixtures |\n| [PT025] | pytest.mark.usefixtures has no effect on fixtures |\n| [PT026] | useless pytest.mark.usefixtures without parameters | \n| [PT027] | use pytest.raises() instead of unittest-style '{assertion}' |\n| [PT028] | test function {name} has default value for argument {arg}, remove it |\n| [PT029] | set the expected warning in pytest.warns() |\n| [PT030] | pytest.warns({warning}) is too broad, set the match parameter or use a more specific warning \u003cbr\u003e (configurable by `pytest-warns-require-match-for`) |\n| [PT031] | pytest.warns() block should contain a single simple statement |\n\n## Installation\n\n    pip install flake8-pytest-style\n\n## Configuration\n\nThe plugin has the following configuration options:\n\n* `pytest-fixture-no-parentheses` \u0026mdash; see [PT001]\n* `pytest-parametrize-names-type` \u0026mdash; see [PT006]\n* `pytest-parametrize-values-type` \u0026mdash; see [PT007]\n* `pytest-parametrize-values-row-type` \u0026mdash; see [PT007]\n* `pytest-raises-require-match-for` \u0026mdash; see [PT011]\n* `pytest-mark-no-parentheses` \u0026mdash; see [PT023]\n* `pytest-warns-require-match-for` \u0026mdash; see [PT030]\n\n## For developers\n\n### Install deps and setup pre-commit hook\n\n    make init\n\n### Run linters, autoformat, tests etc.\n\n    make format lint test\n\n### Bump new version\n\n    make bump_major\n    make bump_minor\n    make bump_patch\n\n## License\n\nMIT\n\n## Change Log\n\n**Unreleased**\n\n...\n\n**2.2.0 - 2025-10-20**\n\n* require at least Python 3.10\n* support Python 3.14\n\n**2.1.0 - 2025-01-10**\n\n* support `reason=` kwarg in `pytest.fail` for [PT016]\n* add [PT028] (checks for default values in test functions)\n* add [PT029] (checks for `pytest.warns` without expected warning)\n* add [PT030] (checks for too broad `pytest.warns` clauses)\n* add [PT031] (checks for multiple statements in `pytest.warns` blocks)\n* require at least Python 3.9\n* support Python 3.13\n\n**2.0.0 - 2024-04-01**\n\n* **BREAKING:** invert default values for `pytest-fixture-no-parentheses` and `pytest-mark-no-parentheses`\n  to conform with `pytest` official style\n  * If you get a lot of [PT001] or [PT023] violations after upgrading, consider setting explicit values\n    for these configuration options\n* require at least Python 3.8.1\n* support Python 3.12\n\n**1.7.2 - 2023-02-15**\n\n* fix false positive for [PT009] on `pytest.fail`\n\n**1.7.1 - 2023-02-15**\n\n* update list of unittest-style assert methods for [PT009]/[PT027]\n\n**1.7.0 - 2023-02-09**\n\n* require at least Python 3.7.2\n* support Python 3.11\n* add [PT027] (checks for unittest-style `assertRaises`)\n\n**1.6.0 - 2021-12-23**\n\n* require at least Python 3.6.2\n* expose `py.typed` file\n\n**1.5.1 - 2021-11-05**\n\n* better wording for [PT011]\n* support Python 3.10\n\n**1.5.0 - 2021-06-18**\n\n* add [PT025] (checks for erroneous `pytest.mark.usefixtures` on fixtures)\n* add [PT026] (checks for `pytest.mark.usefixtures` without parameters)\n\n**1.4.4 - 2021-06-17**\n\n* fix [PT023] not checking marks in classes\n* fix [PT004] incorrectly firing on fixtures with `yield from`\n\n**1.4.2 - 2021-05-24**\n\n* update `flake8-plugin-utils` version to improve stability\n\n**1.4.1 - 2021-04-01**\n\n* fix argparse-related warnings\n\n**1.4.0 - 2021-03-14**\n\n* add [PT023] (checks for parentheses consistency in `pytest.mark` usage)\n* add [PT024] (checks for unnecessary `pytest.mark.asyncio` on fixtures)\n* fix [PT004], [PT005] firing on abstract fixtures\n* fix [PT012] firing on `with` statements containing a single `pass`\n\n**1.3.0 - 2020-08-30**\n\n* add [PT022] (checks for `yield` fixtures without teardown)\n\n**1.2.3 - 2020-08-06**\n\n* update `flake8-plugin-utils` dependency to fix encoding problems on Windows\n\n**1.2.2 - 2020-07-23**\n\n* fix [PT004]/[PT005] inspecting returns of nested functions\n\n**1.2.1 - 2020-06-15**\n\n* fix [PT021] for factory fixtures (#46)\n\n**1.2.0 - 2020-06-12**\n\n* support scoped `mocker` fixtures from `pytest-mock` for [PT008]\n* check for positional-only lambda arguments in [PT008]\n* add [PT020] (checks for `pytest.yield_fixture`)\n* add [PT021] (checks for `request.addfinalizer`)\n* add documentation pages for all rules\n\n**1.1.1 - 2020-04-17**\n\n* fix [PT011] not reporting `match=''` as a violation\n\n**1.1.0 - 2020-04-14**\n\n* add [PT015] (checks for `assert False`)\n* add [PT016] (checks for `pytest.fail()` without message)\n* add [PT017] (checks for assertions on exceptions in `except` blocks)\n* add [PT018] (checks for composite assertions)\n* add [PT019] (checks for fixtures without value injected as parameters)\n\n**1.0.0 - 2020-03-26**\n\n* add [PT014] (checks for duplicate test cases in `@pytest.mark.parametrize`)\n\n**0.6.0 - 2020-03-21**\n\n* add configuration option `pytest-parametrize-names-type` for [PT006]\n* add configuration options `pytest-parametrize-values-type` and\n`pytest-parametrize-values-row-type` for [PT007]\n\n**0.5.0 - 2020-03-09**\n\n* add configuration option `pytest-fixture-no-parentheses` for [PT001]\n* add [PT013] (checks for `from`-imports from `pytest`)\n\n**0.4.0 - 2020-03-09**\n\n* add [PT012] (checks for multiple statements in `with pytest.raises()`)\n\n**0.3.1 - 2020-03-09**\n\n* fix default value of `pytest-raises-require-match-for` config option\n\n**0.3.0 - 2020-03-09**\n\n* add [PT010] and [PT011] (checks for `pytest.raises` parameters)\n\n**0.2.0 - 2020-03-01**\n\n* add [PT009] (ported from [flake8-pytest](https://github.com/vikingco/flake8-pytest))\n\n**0.1.3 - 2019-05-24**\n\n* add `yield` fixtures support\n* fix changelog entry for 0.1.2\n\n**0.1.2 - 2019-05-23**\n\n* fix parametrize checkers not working in decorators\n\n**0.1.1 - 2019-05-23**\n\n* update PyPI description\n\n**0.1.0 - 2019-05-23**\n\n* initial\n\n[PT001]: /docs/rules/PT001.md\n[PT002]: /docs/rules/PT002.md\n[PT003]: /docs/rules/PT003.md\n[PT004]: /docs/rules/PT004.md\n[PT005]: /docs/rules/PT005.md\n[PT006]: /docs/rules/PT006.md\n[PT007]: /docs/rules/PT007.md\n[PT008]: /docs/rules/PT008.md\n[PT009]: /docs/rules/PT009.md\n[PT010]: /docs/rules/PT010.md\n[PT011]: /docs/rules/PT011.md\n[PT012]: /docs/rules/PT012.md\n[PT013]: /docs/rules/PT013.md\n[PT014]: /docs/rules/PT014.md\n[PT015]: /docs/rules/PT015.md\n[PT016]: /docs/rules/PT016.md\n[PT017]: /docs/rules/PT017.md\n[PT018]: /docs/rules/PT018.md\n[PT019]: /docs/rules/PT019.md\n[PT020]: /docs/rules/PT020.md\n[PT021]: /docs/rules/PT021.md\n[PT022]: /docs/rules/PT022.md\n[PT023]: /docs/rules/PT023.md\n[PT024]: /docs/rules/PT024.md\n[PT025]: /docs/rules/PT025.md\n[PT026]: /docs/rules/PT026.md\n[PT027]: /docs/rules/PT027.md\n[PT028]: /docs/rules/PT028.md\n[PT029]: /docs/rules/PT029.md\n[PT030]: /docs/rules/PT030.md\n[PT031]: /docs/rules/PT031.md\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fm-burst%2Fflake8-pytest-style","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fm-burst%2Fflake8-pytest-style","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fm-burst%2Fflake8-pytest-style/lists"}