ned-batchelder I created an issue here: https://github.com/nedbat/coveragepy/issues/1968 And while creating it, I resolved my issue: there is no problem in a clean virtual environment. So this is due to some other library messing up the code coverage logic.