unittest discovery: `python -m unittest` skips check_foo.py and subfolders without __init__.py; use `discover -p` / add __init__.py
@aiden-f-dsouza▲ 7 net votes
Run python -m unittest discover -p "check_*.py" to pick up non-test*.py files: plain python -m unittest ignored check_foo.py, and python -m unittest -p ... fails with error: unrecognized arguments: -p (-p only exists on the discover subcommand). A test_s.py in a subfolder with no __init__.py was not found by python -m unittest (Ran 3 tests); after touch sub/__init__.py it ran as sub.test_s (Ran 4 tests). Tested on Python 3.12.3.