Skip to content

Add ability to use globs when using --ignore#4722

Merged
blueyed merged 3 commits into
pytest-dev:featuresfrom
fetzerch:ignore_wildcards
Feb 8, 2019
Merged

Add ability to use globs when using --ignore#4722
blueyed merged 3 commits into
pytest-dev:featuresfrom
fetzerch:ignore_wildcards

Conversation

@fetzerch

@fetzerch fetzerch commented Feb 5, 2019

Copy link
Copy Markdown
Contributor

This changes the --ignore option to allow Unix-style wildcards so
that --ignore=integration* excludes all tests that reside in files
starting with integration.

Fixes: #3711

@RonnyPfannschmidt RonnyPfannschmidt left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

even tho this is a really nice change, its breaking backward compatibility, i propose adding a --ignore-glob parameter

Comment thread src/_pytest/main.py Outdated
@nicoddemus

Copy link
Copy Markdown
Member

even tho this is a really nice change, its breaking backward compatibility, i propose adding a --ignore-glob parameter

I agree; while I think few users are using * or . in that setting, [] seems more likely.

@fetzerch

fetzerch commented Feb 6, 2019

Copy link
Copy Markdown
Contributor Author

I'll update the PR to introduce a new --ignore-glob parameter. While I'm at it, it appears to be relatively easy to also add support for collect_ignore_glob in conftest.py. Does this make sense to you?

This adds the `--ignore-glob` option to allow Unix-style wildcards so
that `--ignore-glob=integration*` excludes all tests that reside in
files starting with `integration`.

Fixes: pytest-dev#3711
@nicoddemus

nicoddemus commented Feb 6, 2019

Copy link
Copy Markdown
Member

I'll update the PR to introduce a new --ignore-glob parameter.

Great, thanks!

While I'm at it, it appears to be relatively easy to also add support for collect_ignore_glob in conftest.py. Does this make sense to you?

Sorry, what do you mean, a new option, or hook, ?

@fetzerch

fetzerch commented Feb 6, 2019

Copy link
Copy Markdown
Contributor Author

PR is updated now with the --ignore-glob parameter and support for collect_ignore_glob.

While I'm at it, it appears to be relatively easy to also add support for collect_ignore_glob in conftest.py. Does this make sense to you?

Sorry, what do you mean, a new option, or hook, ?

See my second commit. I thought it might be useful and implemented it right away.

@blueyed

blueyed commented Feb 6, 2019

Copy link
Copy Markdown
Contributor

The option collect_ignore_glob could also be used via -o … then, i.e. there wouldn't be the need for a separate CLI option/arg.

Comment thread testing/test_collection.py Outdated
Comment thread testing/test_collection.py Outdated
Comment thread doc/en/example/pythoncollection.rst
This adds the `collect_ignore_glob` option for `conftest.py` to allow
Unix-style wildcards for excluding files.

@nicoddemus nicoddemus left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome contribution @fetzerch, thanks a lot! 🤗

@nicoddemus

Copy link
Copy Markdown
Member

The option collect_ignore_glob could also be used via -o … then, i.e. there wouldn't be the need for a separate CLI option/arg.

I agree with this idea for new options, but given that we have --collect-ignore already, for consistency I think it is OK to have --collect-ignore-glob as well. 👍

@blueyed

blueyed commented Feb 8, 2019

Copy link
Copy Markdown
Contributor

@RonnyPfannschmidt
Please re-review.

@blueyed blueyed merged commit fc8800c into pytest-dev:features Feb 8, 2019
@blueyed

blueyed commented Feb 8, 2019

Copy link
Copy Markdown
Contributor

Thank you!

@fetzerch fetzerch deleted the ignore_wildcards branch February 9, 2019 06:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants