Issue #289 invalid

All the lines are reported as missing

sonal_shirwant
created an issue

Hi I have some python modules along with their unittests.Unittest are written using python "unittest" framework. I tried using coverage.py in the interpreter like this :

import coverage

coverage.erase()

coverage.start()

import x.y.z as testablemodule

import x.y.z.tests.unittests as utests

#this tests belong to z module

utests.run() #this runs all the test

coverage.analyses(utests)

This gives coverage of unittest.py file as 0%

coverage.analyses(testablemodule)

This gives coverage of testablemodule.init.py file as 0%

when we execute tests it calls functions from testablemodule, but then also coverage in 0%

Comments (4)

  1. Ned Batchelder repo owner

    You'll need to provide a runnable example so we can debug the problem.

    The simplest thing is to use coverage to run your tests: "$ coverage run -m unittest discover" or whatever test runner you use. There are many good test runners, these days there isn't much reason to write your own.

  2. Log in to comment