-
-
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
Pytest crashes if there is a subdirectory it does not have read access to #12120
Comments
What is the reason for having inaccessible files in the workspace? Trying to understand if this is something that you intentionally do. |
It's some Docker containers with some databases we use for testing, that has a mounted volume that ends up belonging to another user. We probably could change that if we were sufficiently motivated, but in either case pytest shouldn't crash just because there's a directory it does not have read access to. |
@bluetech the regression (that was added by introducing Directories as is) is that we now collect multiple folders just to get to the given testdirs @jesnie can you try if a collect ignore is a sufficient workaround for now @bluetech i believe there is a need to ensure collect-towards for testpaths and/or test ids will in fact not look in other places that may trigger permission errors |
Sorry about the late reply, but I've been on a small vacation. |
@RonnyPfannschmidt can you not just put a |
Problem
We've had a bunch of issues about this, as far as I can see the issue mainly comes up in these two scenarios:
Proposed SolutionI don't have a great proper solution, so for now I suggest we catch
OK, so the last point is not 100% right, it might matter if a plugin hooks into the right place etc. That's why I'm not intellectually satisfied with this solution. But practicality beats purity, and practically I don't think anyone will ever notice. Rejected SolutionBefore pytest 8, the problem didn't happen because directory collection was "centralized" in The new scheme is IMO simpler and more pytest-y, and it unlocked further simplifications and optimizations (mostly around conftest loading), and also custom directory node support. So I don't think we want to go back. Possibly there's a way to keep the new scheme but also delegate the filtering, thus fixing the problem properly. If a future human or machine reads this and comes up with a proposal to do this, that'd be cool :) |
Pytest crashes if there is a subdirectory it does not have read access to.
For example:
yields:
I do not believe pytest should be this sensitive to what other subdirectories there might exist.
This is run under Ubuntu 22.04.3 LTS under WSL.
pip list
from the virtual environment you are usingThe text was updated successfully, but these errors were encountered: