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.
The
python_classessetting 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 likeForCurrentUser, which I want tests to be discovered under. However, I also use mixin classes likeForbidsAnonymousUsersto include common tests in other test contexts.To support my case, I've been using a custom plugin to allow dashes in
python_classesto represent CamelCase word boundaries: https://gist.github.com/25861e8acd564fe3a0e4a9f45b54a316I wondered if it might be useful to anyone else before I write up a PR.