Recursive unittest discovery with python3 and without __init__.py files Recursive unittest discovery with python3 and without __init__.py files python-3.x python-3.x

Recursive unittest discovery with python3 and without __init__.py files


I looked into it, and think its most likely a bug.

So I created a python bug report and a PR which fixes the issue for me.

Clone it and see if it works for you as well, with the fix the best way of running discover was python -m unittest discover -s tests. Otherwise it will look in for example virtual environments that are below the top dir.


Note that namespace package is regular package.You must not expect namespace package is treated same to regular package.

Read this article too.https://dev.to/methane/don-t-omit-init-py-3hga


Use pytest. It does discover tests in folders.

In your case you just need to install in via pip (pip install pytest) and then run in your root folder pytest tests.