coverage.py reports method and class defnitions as covered by default.

Issue #489 invalid
Former user created an issue

Thanks for such a great tool (coverage.py). I am running into below issue .

We use python based on gel and gevent. When I run coverage using coverage run option..

I see that all method and class declaration lines as covered (+ also the variables of the class.

As an example,

**class A{ var1 = val1; var2 = val2; var3 = val3;

method1(){** statement1; statement2; statement3; } }

Even when I run just a dummy test without any calls, the above bolded lines (1-5) shown as covered (in every class of the code base). I tried concurrency=gevent and --timid options and still no change.

Thanks, Venkat .

Comments (2)

  1. Ned Batchelder repo owner

    In Python, a "class" or "def" statement is truly an executable statement. When you import a module, all the top-level statements, including "import", "class", and "def" are actually executed. Coverage.py observes this, and indicates that the lines are executed.

  2. Log in to comment