Seems like the following is required:
- A directory inside which the code lives (in our case
lib/
), with an__init__.py
file therein - A subdirectory of this directory called
test/
, again with an__init__.py
file within - test files for (for example)
lib/foo.py
should live inlib/test/test_foo.py
Functions from the lib/
folder can then be imported as follows:
# File: lib/test/test_foo.py
from lib import foo
a_variable = foo.fun(1)
You can run tests as follows:
python -m unittest