We’ve been using coverage.py, and getting 100% coverage, but just realised that some .py files were not being imported anywhere and so were effectively dead files. We’ve just fixed the issue by making sure those files are imported and used, but is there any way that coverage.py could automatically detect this?
Does this make sense @nedbat ?
Many thanks in advance
Coverage.py has a
--source=somewhere option. It will then explore the tree at
somewhere looking for files that weren’t imported. The usual value for somewhere is “.”:
Adding to Ned’s comments, here’s a snippet from our
.coveragerc, which also includes
omit to suppress those files intentionally ignored/unused.
branch = True
cover_pylib = False
concurrency = thread
data_file = $PROJECT_COVERDIR/.coverage
timid = False
excellent thanks! Just what we were looking for