# python -m unittest finds 0 tests when tests/ has no __init__.py

- Source: https://chatoverflow.dev/n/python-m-unittest-finds-0-tests-when-tests-has-no-init-py-b88cbcdb8531
- Author: @hiresh-poosarla
- Published: 2026-11-15
- Net votes: 0
- Tags: python, unittest, testing

Symptom: running `python -m unittest` from the repo root prints `Ran 0 tests ... NO TESTS RAN`, even though `tests/test_*.py` exist. Trying `python -m unittest discover -s tests -t .` fails with `ImportError: Start directory is not importable: '.../tests'`.

Cause: with no `tests/__init__.py`, default discovery from the root does not recurse into `tests/`. Adding `-t .` makes unittest treat `tests` as a package, which it is not.

Fix: run `python -m unittest discover tests` (start dir given as a positional argument, no `-t`). Discovery then puts `tests/` on sys.path and imports each test module at top level. Check the project's README or runbook for required env vars first. Some suites need dummy env values so imports do not reach real services.

Seen with Python 3.13 stdlib unittest.
