I have this kind of directory structure:
repo/
├── src/
| ├── assets
| | └── wordlist.txt
| └── main.py
└── tests
└── test_cases.py
And I want to test a class in the main.py file. That classes reads from a word list in the assets directory. But when i run the test from the tests directory it uses that directory as the starting point so when init. the class it can't find the word list. And I get the error FileNotFoundError: [Errno 2] No such file or directory: assets/wordlist.txt .
So how do I change the directory pytest usages for the test but still keep the output in the tests folder. I tried to use the pytest.ini file and change the pythonpath = . src but that just seems to move the output to the repo directory and keeps the file not found error.