-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
support conftest/ folders #13108
Comments
There should be better support for including modules in toplevel contests They shouldn't be packages themselves to limit scope |
I like the idea, and I think it fits in very well with the model how pytest currently works (things from We have the
Big +1 for this solution from my side. It expands on what is already common practice instead of introducing something entirely new. Thus, it seems very obvious if you know what a @RonnyPfannschmidt what do you mean with "They shouldn't be packages themselves to limit scope"? |
Oh, I missed the My mental model was that pytest automatically loads everything in
...which I now suppose is what @RonnyPfannschmidt meant with "they shouldn't be packages themselves" above too? |
I think it's necessary to define behavior in more detail Like is test collection allowed in there How to handle fspath wrsppers for contest packages There's a lot going on Id much prefer a config entry that lists a glob of projects global plugin files tham expanding conftest to a package and expanding all its special handling correctly |
I think that'd deviate from pytest's general "convention over configuration" philosophy. I do recognize that this has bitten us in the past, but I think there's a lot of value in seeing a The test collection question should be an easy answer, we already have the same situation with I'm sure there will be some internals to adjust with how central of a concept |
I believe we should limit it to toplevel conftests |
What's the problem this feature will solve?
I'm tired of putting so much code in a single
tests/conftest.py
file.Describe the solution you'd like
It'd be nice if I could expand
conftest.py
into a folder, like this:Alternative Solutions
I could create a different folder, like
tests/lib/
, add code there, and import that code fromtests/conftest.py
, but I'd prefer to keep the rest of thetests/
namespace free. For example, the way I organize my tests is identical to how I organize my code. If I have a source filelib/foo.py
, I'll create tests for it intests/lib/test__foo.py
. If I usedtests/lib/
to instead store setup code for the test suite, that would conflict with the above convention.The text was updated successfully, but these errors were encountered: