I'm using python pytest to run my unit tests.
My project folders are:
Main - contains data file: A.txt
Main\Tests - the folder from which I run pytest
Main\Tests\A_test - folder that contains a test file
The test in A_test folder uses the file A.txt (that is in Main folder).
My problem is that when I run py.test the test fails because it can't find A.txt.
I found out that it is because pytest uses the path Main\Test when running the test instead of changing the path to Main\Tests\A_test (I'm using relative path when opening A.txt inside the test file)
My question: is there a way to make pytest change directory to the folder of the test it executes for each test? so that relative paths inside the tests will still work? 
Is there some other generic way to solve it? (I don't want to change everything to absolute paths or something like this, also this is an example, in real life I have several hundreds tests).
Thank you,
Noam
Adding __init__.py to the package of the tests worked for me. All test are executed afterwards.
Using pytest where test in subfolder