-
I'm using pytest-factoryboy and the factory boy fixture can't be found after updating pytest to 6.1.1.
File
File
File
On OSX, using pytest 6.1.1, works:
On Linux, the same fails:
If I downgrade pytest to 6.1.0, it works:
|
Beta Was this translation helpful? Give feedback.
Replies: 10 comments
-
Works fine for me:
Can you maybe share a built docker image where this can be reproduced? |
Beta Was this translation helpful? Give feedback.
-
Thanks for he quick feedback. When creating a docker image with the following
I pinned the issue to the
The error In this example, those files were generated on my mac, so I understand I should have cleaned that directory. In my original problem, the tests are always run inside the docker container, but I mount the app directory as a volume. I found some pyc files generated:
Moving the |
Beta Was this translation helpful? Give feedback.
-
I saved the old |
Beta Was this translation helpful? Give feedback.
-
After checking I saw that VS Code is creating that file when discovering the tests. So I guess that's what happened. You can close this issue. Sorry for the noise. |
Beta Was this translation helpful? Give feedback.
-
Hmm, I still wonder how this can happen though! By any chance, can you reproduce when you run |
Beta Was this translation helpful? Give feedback.
-
If I run If you pull this image, you can reproduce the problem. Running
|
Beta Was this translation helpful? Give feedback.
-
To summarise, it seems the full path of the files is used inside the
Same issue with pytest 5 but not with pytest-4.6.11:
|
Beta Was this translation helpful? Give feedback.
-
I'm not really familiar with how pytest generates/reads .pyc files as part of its assertion rewriting - maybe someone else can look into this? |
Beta Was this translation helpful? Give feedback.
-
We check for the This is not pytest specific, Python stores full paths inside I'm not sure there's anything to be done by pytest here. Perhaps we can edit the title and turn this into a discussion for others to find in the future? |
Beta Was this translation helpful? Give feedback.
-
I agree. I don't think pytest should try to handle this. It's fine to close this issue. It's more something to be aware. |
Beta Was this translation helpful? Give feedback.
To summarise, it seems the full path of the files is used inside the
pyc
files instead of relative path. This isn't a platform issue. It can easily be reproduced using docker by mounting the same directory in 2 different locations: