How to properly use coverage.py in Python?
I've just started using Coverage.py module and so decided to make a simple test to check how it works. Sample.py def sum(num1, num2): return num1 + num2 def sum_only_positive(num1, num2): if num1 > 0 and num2 > 0: return num1 + num2 else: return None test.py from sample import sum, sum_only_positive def test_sum(): assert sum(5, 5) == 10 def test_sum_positive_ok(): assert sum_only_positive(2, 2) == 4 def test_sum_positive_fail(): assert sum_only_positive(-1, 2) is None As you see, all my code is covered with tests and py.test says all of them pass. I expect Coverage.py to show 100% coverage.