Skip to content

Commit 2ba8fd5

Browse files
authored
Re-export importlib.metadata from _pytest.compat (#9906)
I'm fixing a bug in mypy's --no-implicit-reexport logic in python/mypy#12704 and mypy-primer flagged this
1 parent e580534 commit 2ba8fd5

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

changelog/9906.trivial.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Made ``_pytest.compat`` re-export ``importlib_metadata`` in the eyes of type checkers.

src/_pytest/compat.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,11 @@ class NotSetType(enum.Enum):
5050
# fmt: on
5151

5252
if sys.version_info >= (3, 8):
53-
from importlib import metadata as importlib_metadata
53+
import importlib.metadata
54+
55+
importlib_metadata = importlib.metadata
5456
else:
55-
import importlib_metadata # noqa: F401
57+
import importlib_metadata as importlib_metadata # noqa: F401
5658

5759

5860
def _format_args(func: Callable[..., Any]) -> str:

0 commit comments

Comments
 (0)