Skip to content

excluding name patterns from consideration #477

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
pytestbot opened this issue Mar 6, 2014 · 4 comments
Closed

excluding name patterns from consideration #477

pytestbot opened this issue Mar 6, 2014 · 4 comments
Labels
type: enhancement new feature or API change, should be merged into features branch

Comments

@pytestbot
Copy link
Contributor

Originally reported by: BitBucket: faassen, GitHub: faassen


Today I ran into the following. I started using a library called webtest, which exposes a class called TestApp which can be used to test WSGI apps.

The very act of doing this:

from webtest import TestApp

would trigger pytest to consider TestApp as something to find tests on, but would then immediately skip it. The skipping process is visible and at least the display of it is so slow you actually see the number increased: for 9 modules that import TestApp, the number goes up to 9.

I'd like a way to configure pytest to exclude the pattern 'TestApp' from any consideration whatsoever. I think this may be possible using pytest_pycollect_makeitem, but that got quickly rather complicated. Could a configuration option be added for this use case?


@pytestbot
Copy link
Contributor Author

Original comment by holger krekel (BitBucket: hpk42, GitHub: hpk42):


Sorry for taking a while to answer: I think about supporting the nose-style "notest" attribute. If pytest finds it on a class or function, it would ignore it. It would mean you would need to set TestApp.notest = True, maybe in your conftest.py file. That's a slight hack but OTOH designing a config option, documenting that, and making it work without introducing too much overhead ... not sure it's worth it. And there would still be the issue of nose-compat.

@pytestbot pytestbot added the type: enhancement new feature or API change, should be merged into features branch label Jun 15, 2015
@The-Compiler
Copy link
Member

Can this be closed as there is a way to do what you need, @faassen?

@RonnyPfannschmidt
Copy link
Member

closing due to known solution and lack of feedback

@adamchainz
Copy link
Member

I was just trying to fix the warning from Pytest that is still emitted with webtest's TestApp. I found this issue, but the response is sligthly wrong, it's not notest, but __test__ = False that is needed, as per Pytest's nose docs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: enhancement new feature or API change, should be merged into features branch
Projects
None yet
Development

No branches or pull requests

4 participants