My source files are located under src and my test files are located under tests. When I want to run a test file, say python myTest.py, I get an import error: “No module named ASourceModule.py”.
How do I import all the modules from source needed to run my tests?
Advertisement
Answer
You need to add that directory to the path:
import sys sys.path.append('../src')
Maybe put this into a module if you are using it a lot.