0

I have been adding type checking with MyPy to various python projects and I've found that doing so prevents Coverage from properly generating test coverage reports. Specifically it prevents coverage from overwriting it's htmlcov directory, it works as expected if I delete this directory before running coverage.

While MyPy and Coverage seem like they should be completely unrelated I have seen this behaviour in multiple projects, always after adding type checking.

I am using:

  • python 3.9.6
  • pytest 6.2.4
  • pytest-cov 2.12.1
  • coverage 5.5
  • coveralls 3.2.0
  • mypy 0.910

Coverage reports are generated with pytest.

axevalley
  • 335
  • 2
  • 10
  • Hm, it's hard to imagine how mypy could prevent coverage from writing to its htmlcov directory. If you could open an issue at https://github.com/nedbat/coveragepy/issues/new/choose with specific instructions to reproduce the problem, I would like to take a look. – Ned Batchelder Aug 11 '21 at 21:15
  • 1
    @NedBatchelder I agree that on the surface it doesn't make much sense. I'll have a play to make sure I know how to reproduce the issue then go ahead and open that issue. – axevalley Aug 12 '21 at 13:32

0 Answers0