Skip to content

Seeking improved pytest rules, as flake8-pytest-style doesn't align with best practices #8796

@RonnyPfannschmidt

Description

@RonnyPfannschmidt

hi everyone,

before i evaluated ruff i wasn't even aware of flake8-pytest-styles,
as one of the pytest maintainers i'm particularly annoyed as the rules don't reflect documented and communicated best practices and the upstream doesn't seem likely to change those details

  • PT001 should be reversed (drop brackets)
  • PT004 is simply incorrect - public no return value fixtures should have public names for both usage in the usefixtures maker and as dependencies in other fixtures
  • PT005 is equally incorrect - internal fixtures return values even if underscores are used - sabotage of that is not ok
  • PT006 undoes the intentionally established pattern of being able to comma separate multiple names in a single string
  • PT009 sabotages intentional usage of unittest (which is sometimes necessary)
  • PT021 sabotages well established patterns for complex fixtures that setup in phases where on needs to ensure teardown but ought not to split them into multiple smaller fixtures
  • PT023 should drop parens on marks by default
  • PT024/25 should warn on any mark on a fixture as no marks are supported on fixtures
  • PT027also sabotages legitimate usage of unittest patterns

Metadata

Metadata

Assignees

No one assigned

    Labels

    ruleImplementing or modifying a lint rule

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions