Mypy cannot find the Coverage type from version 7.2.0 · Issue #1564 · nedbat/coveragepy (original) (raw)

Describe the bug

Mypy complains about not being able to find the Coverage attribute from the coverage module.

To Reproduce

Following the documentation:

import coverage

cov = coverage.Coverage()

and applying mypy leads to the following error:

error: "Module coverage" does not explicitly export attribute "Coverage" [attr-defined]

However, doing:

import coverage

cov = coverage.control.Coverage()

works fine.

Expected behavior

Mypy should not complain about the type when Coverage objects are used according to the documentation.

Additional context

This problem appeared starting 7.2.0 (using 7.1.0 works fine).