-
Notifications
You must be signed in to change notification settings - Fork 91
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
Module scoped pytest fixture raises error #684
Comments
Can you please add a minimal reproducible example, or at least a bit more context? Is |
I assume this happens only with the module-scoped fixture, not with the function-scoped |
I apologize for the lack of info. I just managed to create a repro:
Creating a clean environment using the latest pytest and pyfakefs with these two files produces the error. Seems like the |
Thank you for the example! At a first this looks like a clash between the 2 fixtures - at some point the temp file is probably created in the fake filesystem, but accessed in the real fs. It may be that the fixtures just won't work together nicely, or that Keep in mind that you won't really use the temp directory here, as it will live in the fake file system. Maybe you don't need the |
Thanks for looking into this!
You are correct, however, I'm using the fixture with |
This is a regression in pyfakefs, though I'm not sure yet how to fix it. The change has been introduced in pyfakefs 3.5.5. import _pytest
Patcher.SKIPMODULES.remove(_pytest.pathlib) I suspect though that this will cause other problems, as the change has been introduced for compatibility with pytest 7.0. If that is the case, you can temporary downgrade to pytest < 7.0 (additionally to that change). A fix will probably take some time, so you can use this as a workaround for the time being. Some background info (mostly for myself, you may ignore this): |
- fixes pytest-dev#666 without the need to skip _pytest.pathlib patching - add module and session scoped fs fixtures - fixes pytest-dev#684
There turned out to be an easy fix for #666 that I overlooked at the time - should be fixed in master now. I'll probably make a new release in a few days if nothing else comes up. |
Reopen as there still can be an error logged on test shutdown (which does not affect the tests though). |
Removing regression label, as the regression is fixed. |
I investigated some more, and it turned out to be a problem with combining the usage of |
Describe the bug
Hello, when I try to create this
I get this error when the function yields
Your environment
Please run the following and paste the output.
The text was updated successfully, but these errors were encountered: