Skip to content

python_classes: match class names on word boundaries #4128

@theY4Kman

Description

@theY4Kman

The python_classes setting instructs pytest to include or ignore certain classes for test discovery based on their classname. I've been using some BDD/declarative-style test context names like ForCurrentUser, which I want tests to be discovered under. However, I also use mixin classes like ForbidsAnonymousUsers to include common tests in other test contexts.

To support my case, I've been using a custom plugin to allow dashes in python_classes to represent CamelCase word boundaries: https://gist.github.com/25861e8acd564fe3a0e4a9f45b54a316

I wondered if it might be useful to anyone else before I write up a PR.

Metadata

Metadata

Assignees

No one assigned

    Labels

    type: enhancementnew feature or API change, should be merged into features branchtype: questiongeneral question, might be closed after 2 weeks of inactivity

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions