Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
resolve manually set basetemp to a absolute path #4425
We're experiencing some issues with new tmpdir implementation using pathlib. Starting from pytest 3.9.0 our tests started to fail.
We are using test class and a pre_process fixture, which prepares some data for the other tests within the class. In the test methods we're using the pre_process fixture (to access the data) as well as the tmpdir pytest builtin fixture to store some outcomes of the tests. Minimal failing example is pasted below:
Because of the directory change in test_dummy, next invocation of the tests fail due to pathlib error, as below:
and in fact we end up with 1 pass and 2 errors in this particular case.
We currently have workaround for this issue (store the cwd before changing it and restore it before the test end), but I'd like to ask you if this is how it should behave? I'd expect that state of one test does not influence the other test's state.
The issue is observable if no class hierarchy is used as well.
Another workaround (a little bit nasty) is to reset internal pytest variable in pre_process macro:
$ pip list
also a sidenote - i'm testing with pytest 4 myself and i don't see an issue on my system, so we might be looking at a environmental/hard to replicate issue
since the "temporary directory" that seems to be used in your example is a relative path, i do wonder if it might be a miss-configured environment and if/how we should warn