Even within the framework of the project structure is complex, and test tables use src in different packages, you can add PYTHONPATH to Environmental Variables on Windows
My computer โ Properties โ System properties โ Advanced tab โ Environmental variables. Add a new system variable PYTHONPATH and add the dir to this variable with the delimiter ';'
I suggest you keep readme.txt in your project, which clearly talks about how to add PYTHONPATH to run scripts. This is similar to adding PATH android-sdk to make the adb shell work by adding a Java path to make Java work on the command line.
Thus, readme.txt helps to run the script when loading on another machine with only one change (adding the variable PYTHONPATH with value = path to the project)
No need to add all src modules to make test files work using src
Here is an example proj structure:
SAMPLEPROJECT src com sample example utils a.py b.py testcases test1.py test2.py res docs
If the test1.py test case uses a.py and and b.py: Do not add the utils module to PYTHONPATH, since you have already added the path to the python path, the import statement looks something like this: test1.py
from src.com.sample.example.utils import a.py from src.com.sample.example.utils import b.py
source share