I have tests that create a temporary Python file, imports it, and then deletes it. This file gets picked up by coverage, which then cannot find it when it tries to generate a report.
This results in the process printing the following message and quitting with a non-zero error code:
No source for code: '/private/var/folders/b0/b6pkmtfs21q38h40ccwzyyvc0000gn/T/tmpi9s9g0nx/module_b.py'.
It was not obvious to me the first time that generating the report had failed. A more helpful error message would say something like:
Failed to generate a report! No source for code: /some/path. To ignore missing source files, set ignore_errors to True in your configuration.
I'm happy to provide a fix here, if given some guidance on a suitable error message.
Also, following the error, I was also momentarily confused by the presence of an old run's coverage files in htmlcov. Should the htmlcov directory be cleared every time an HTML report is generated?