Skip to content

Mypy no_implicit_reexport x testfixtures #178

@g-as

Description

@g-as

Hi,

when enabling no_implicit_reexport, mypy displays:

***.py:98:5: error: "Module testfixtures" does not explicitly export attribute "compare"  [attr-defined]

It happens whether from testfixtures import compare or import testfixures; testfixtures.compare(..., ...).

According to the docs, you either have to have in __init__.py from testfixtures.comparison import compare as compare or __all__ = (..., "compare", ...).

Would you be willing to modify the __init__.py in order to address this?

If so, I can draft a PR depending on which way you prefer (either with __all__ or with from foo import bar as bar).

Some context/examples on this particular issue:
python/mypy#10198
konradhalas/dacite#133
konradhalas/dacite@a7834ba
pallets/quart@c219d96

In any case, a way to disable this mypy flag only for testfixtures is with:

[[tool.mypy.overrides]]
module = "testfixtures"
implicit_reexport = true

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions