-
-
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
Autouse fixtures in Packages (__init__.py) #4085
Comments
Looking at the code, I'm not so sure if this is a bug or just how things are intended to work.
But for fixtures we don't have the same guarantees, as fixtures that are meant to be shared are supposed to go into To fix this will mean to make autouse fixtures in packages to apply to all test modules under it, like a @RonnyPfannschmidt thoughts? |
@nicoddemus structurally we simply never had packages share structural locations with test files i beleive we need to take a close look on what should go to conftest, package and how things interact, and then deprecate some things harshly our life cycle policies are unable to adequately handle the issue at hand, its going to be a mess |
OK, so I will go on with #3094 (I can workaround this) and defer this discussion for later. |
I'm bumping into this issue a few years later. I agree that workarounds can be found, but this isn't the way things are expected to work. If everything in the tests' root |
Autouse fixtures defined in package
__init__.py
files are not being executed for tests under the package.Consider:
This fails because
startup()
is never called.If however we replace
startup
by a xunit-stylesetup_module
function:Then the test passes.
Discovered this bug while working on #3094. 😬As discussed below, we have to discuss if this is a bug or not.
The text was updated successfully, but these errors were encountered: