Pytest and PYTHONPATH

Hello.

I am soon finished with exercise 51 in LPTHW (3).
But there is the test to write. Here I choose my favourite Pytest instead.
For some reason I had some problem in this enviorment (venv) to run the test.
I got “ModuleNotFounderror: no module named ‘app’”
Some reseach on Google gave me the solution to run with python -m pytest tests/test_app.py wich worked fine.
Another solution was to add a path (PYTHONPATH= py.test).

I would like to know if I should write py.test or pytest? Or something else?
I do not want to mess up things (python, pytest, venv…) so everything else will not work anymore.

Try setting PATHONPAT=. (that’s equal to dot). That should tell it to look in the current directory.

Hello @zedshaw.

Thanks for reply. Unfortunately i cannot tell if this worked or not. I tried it but could not see any change.
I also found out I had messed up the folder a bit while trying different things. Two venvs in the same projects folder(ex50). One in ex50 and the other in a subfolder. A ”conftest.py”(used in Pytest) where it should not be at all.

I throw everything out. Even some files that probably was ok.
I guess there is no harm in repetition.
:slightly_smiling_face:

Ah, ok, just remember the PYTHONPATH=. trick in the future.