Closed jgonggrijp closed 4 years ago
@jgonggrijp can you paste the output of pytest --trace-config please?
I was going to do that and was censoring the filesystem paths in preparation. While scrolling through the output, I noticed that backend/conftest.py
was actually mentioned. This prompted me to check whether the missing fixture was really in that file. It was. But then I realized I didn't decorate it with @pytest.fixture
. Despite having imported pytest
for this purpose. 🙄 Adding that line solved the problem, i.e., it confronted me with a failing test rather than a missing fixture.
Sorry for the noise. 🤐
@jgonggrijp thanks for the follow-up, such brain-blips are a pain to note on your own (been there, blinked at it, face-palmed after someone else pointed it out)
I'm testing a Django project with pytest and I'm struggling with a conftest import issue. This is a simplified version of my directory layout:
I tried running
pytest
andpython -m pytest
from within the backend directory as well aspytest backend
andpython -m pytest backend
from its parent directory. In all cases, pytest does not recognizebackend/conftest.py
as something that should be imported. It will simply tell me that the fixtures in that file don't exist.pip list
from the virtual environment you are usingpytest 4.6.6, macOS 10.14.6
Sorry, not at this time.