I'm doing this in a way that I'm not 100% is standard, but it's working for the meantime:
So, as you can see, I don't have a main.py
in this mock-up, yet. What I do have are modules in one folder and tests in the other.
The main "trick" (and, again, I'm not sure it's advisable) is to climb down the folder hierarchy using sys.path.append
and __file__.rsplit('\',2)
. The other trick is that, if called as main, every module loads up the init and tests itself, but if the init file is called, it tests all of the modules.
Hopefully someone can show you a better solution, but this may work in a pinch.