- reference: https://stackoverflow.com/questions/29713541/recursive-unittest-discover
- author: adam-smith https://stackoverflow.com/users/3058609/adam-smith
In doing a bit of digging, it seems that as long as deeper modules remain importable, they'll be discovered via python -m unittest discover. The solution, then, was simply to add a init.py file to each directory to make them packages.
.
├── LICENSE
├── models
│ └── __init__.py
├── README.md
├── requirements.txt
├── tc.py
├── tests
│ ├── db
│ │ ├── __init__.py # NEW
│ │ └── test_employee.py
│ ├── __init__.py # NEW
│ └── test_tc.py
└── todo.txt
So long as each directory has an init.py, python -m unittest discover can import the relevant test_* module.