[pytest-dev] -k EXPRESSION: How to allow for case-insensitive matching
nicoddemus at gmail.com
Wed Dec 4 08:58:09 EST 2019
On Wed, Dec 4, 2019 at 9:38 AM Christoph Buelter <
buelter.christoph at gmail.com> wrote:
> the -k EXPRESSION matching behaviour of the pytest CLI, which deselects
> tests based on the given expression, is case-sensitive.
More than once I've myself wished that it would be case-insensitive. :)
> I also acknowledge that the default behaviour can't be changed as it would
> break existing code.
Not sure, -k is usually used interactively, not being part of CI
configuration ("usually", I certainly can see it being used as such to
select a sub-set of tests for a specific CI run, for example "-k
> I have not found a way to customize this with the existing CLI/hooks.
> Do you think there is any possibility to add some CLI/config option like
> "--case-insensitive-expression" to make this configurable, or do you
> consider this to belong to userland? A hook to allow changing the behaviour
> from a pytest plugin would be totally sufficient as well. I'd be willing to
> provide a PR if there is any interest.
I would actually vote to change the existing behavior to be
case-insensitive. I doubt it would break many suites, if at all, and would
be more in alignment with the intent of the option, more of it being a
"partial match" than an exact match, as it matches against any portion of
the node id currently anyway.
Does anybody sees this differently?
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the pytest-dev