Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-23-2025 01:42 AM
This assumption is wrong.
If you look into the directory structure, there is a pytest ini file. This should contain something like:
[pytest]
testpaths = tests
pythonpath = src
pytest ini is executed when you run pytest. so it will append the src dir (where main.py resides).
But afaik this only works if you run pytest from the directory where pytest ini resides.
In this case you first have to navigate to the correct directory (cd <project>), and from there run pytest.
pytest ini will then be executed and it should work.
there are other ways to make it work f.e. moving main_tests.py to the same dir as main.py etc but i think that first navigating to the correct dir should make it work.