-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Description
It seems over the time pytest introduced realpath calls to resolve symlinks. When trying to use pytest with https://bazel.build/ however that falls flat because is executing all tests in an isolated sandbox (think lightweight docker) and is for performance reason just symlinking files rather than copying them and it expects tools to respect symlinks. Further it only puts the files into the sandbox that it needs for that test, so it might just be the pytest dependency, the testfile itself and the library that is needed for it. The problem I am now facing is, that pytest is resolving the symlink of the testfile, ending up in my real project directory, discovering a __init__.py file there and then complaining about missing imports because the isolated python provided by bazel does not have access to these for running the test.
It would be nice to get an option for pytest to just treat symlinks as the real files and not try to resolve them. In the nodejs world for example the flag --preserve-symlinks exists for that and it would be great to get the same for pytest.
Let me know if you need a minimal reproduction case, then I am happy to provide one.
pytest version 4.4.2, OS: Elementary OS 5 (Ubuntu 18.04)