Coverage not reported for simple assignments when using the API

Issue #102 resolved
eduardo schettino
created an issue

Simple example to reproduce the problem below. The statement "a = 5" is reported as not executed.



import coverage

def my_func(): b = 10

def test_coverage(): cov = coverage.coverage() cov.start()

a = 5


if name == "main": test_coverage()


Comments (4)

  1. eduardo schettino reporter

    Thanks. Just clarifying the docs is ok. I just notice this while trying something quickly.

    IMO Since the API works like this, it would be clearer if there was a single function that takes a callable instead of a "start", "stop" methods.


    Since we are talking about making the docs clear... I have another suggestion :D

    I also got confused with the section "Measuring Subprocess". It doesn't mention that I need to use "coverage combine"... or maybe just a link to "parallel options" docs would be enough.


  2. Log in to comment