[TIP] Test added (and executed) isn't increasing apparent coverage

Ned Batchelder ned at nedbatchelder.com
Sun Apr 5 16:00:53 PDT 2020

On 4/4/20 10:34 AM, Skip Montanaro wrote:
>     Is your run_tests.py executing 'python ... -m test ...' in a
>     subprocess?
>     Have you done the necessary groundwork to enable multi-process
>     coverage
>     tracking?  I think not -- I don't see '-p' passed to 'coverage
>     run', nor
>     a 'coverage combine' command in your Makefile.
>     Do check the documentation:
>     - https://coverage.readthedocs.io/en/latest/subprocess.html (which
>       page surprises me by not mentioning 'coverage combine', TBH)
>     -
>     https://coverage.readthedocs.io/en/latest/cmd.html#combining-data-files
> Thanks for your help, Marius. I'm still stuck, however. I read the 
> docs, replaced -a with -p and created a sitecustomize.py file in my 
> checkout's Lib directory. Despite exiting with a zero status, this 
> command:
>     ~/.local/bin/coverage run -p --source=${PWD}/Lib/rattlesnake
>     ./Tools/scripts/run_tests.py test_rattlesnake
> produces no .coverage.HOSTNAME.PID.RANDOM file. This however does:
>     ~/.local/bin/coverage run -p --source=${PWD}/Lib/rattlesnake
>     $(HOME)/tmp/junk.py
> The lack of any coverage data from running the unit test would seem to 
> be at the root of my problem.

You need to also define the environment variable COVERAGE_PROCESS_START 
to point to the .coveragerc file to use. You haven't mentioned it, so 
perhaps this is what is missing?


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.idyll.org/pipermail/testing-in-python/attachments/20200405/323fb173/attachment.html>

More information about the testing-in-python mailing list