I'm starting to learn pytest and I want to integrate it with Travis later on. I've created my first tests and I can run them from PyCharm without any problem. But when I try to run pytest from Linux's terminal I get the following error:
Hint: make sure your test modules/packages have valid Python names.
Traceback:
/usr/lib/python3.6/importlib/__init__.py:126: in import_module
return _bootstrap._gcd_import(name[level:], package, level)
test_prob.py:1: in <module>
from src.agents import prob
E ModuleNotFoundError: No module named 'src'
I've found some similar problems and solutions for them but none of them have worked for me. My project structure looks as follow
I ran into the same issue, and my solution was to execute pytest
as a module.
python -m pytest
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With