Issue #216 new

Coverage not searching subdirectories properly

NegatedVoid
created an issue

If I run "coverage run --source="../../src" run_test.py", then coverage ends up skipping the 'apps' subfolder of 'src'.

This command: coverage run --source="../../src" run_test.py && coverage report

Checks like 4 python files.

and this command: coverage run --source="../../src/apps" run_test.py && coverage report

Checks like 100.

Shouldn't the subfolders be included? Am I doing something wrong?

Thanks, --Murph

Comments (2)

  1. Ned Batchelder repo owner

    My best guess is that the apps directory doesn't have a init.py file. Other than the root of the tree, coverage.py will only consider a directory if it is importable, which requires a init.py.

    You can use: --source="../../src,../../src/apps" to get what you want, if that is what's wrong. If that isn't what's wrong, provide more details, and we can figure it out.

  2. Log in to comment