I am learning to write tests and I am having issues with the PyCharm configuration.
First, I had this issue in windows 11 where the pytest command would get stuck. The solution was to run a pytest command as an administrator once first.
Now, if I click on the green run symbols next to my test functions, they are launched but get stuck at the collecting phase:
============================= test session starts =============================
collecting ...
I think this is because pytest cannot find my project folder. If I run pytest within the pycharm terminal:
python -m pytest ./tests
I get this error:
ModuleNotFoundError: No module named 'myproject'
This is my folder structure:
myproject/
docs/
examples/
src/
myproject/
functionsA.py
functionsB.py
tests/
test_functionsA.py
I wonder if anyone could please help me to to avoid these issues and properly run pytest from the pycharm sidebar launch icons and/or pycharm terminal.