Skip to content

Mypy cannot find the Coverage type from version 7.2.0 #1564

Closed
@lucas-bremond

Description

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).

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingfixed

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions