Skip to content

Commit e212be4

Browse files
authored
Fix compatibility with pytest 7.2 (#106)
With pytest 7.2, the remaining parts of the "py.path" library got vendored, to get rid of the dependency: pytest-dev/pytest#10396 However, this breaks due to pytest_mypy_plugins importing private API: File ".../pytest_mypy_plugins/collect.py", line 13, in <module> from py._path.local import LocalPath ModuleNotFoundError: No module named 'py._path'; 'py' is not a package Use py.path.local instead (the public name of the same type), which is part of the shim included in pytest.
1 parent 19de6e5 commit e212be4

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# Version history
22

3+
## Version 1.10.1
4+
5+
### Bugfixes
6+
7+
- Fixes compatibility with pytest 7.2, broken due to a private import from
8+
`py._path`.
39

410
## Version 1.10.0
511

pytest_mypy_plugins/collect.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@
66
from typing import TYPE_CHECKING, Any, Dict, Iterator, List, Mapping, Optional, Set
77

88
import pkg_resources
9+
import py.path
910
import pytest
1011
import yaml
1112
from _pytest.config.argparsing import Parser
1213
from _pytest.nodes import Node
13-
from py._path.local import LocalPath
1414

1515
from pytest_mypy_plugins import utils
1616

@@ -151,7 +151,7 @@ def pytest_collect_file(file_path: pathlib.Path, parent: Node) -> Optional[YamlT
151151

152152
else:
153153

154-
def pytest_collect_file(path: LocalPath, parent: Node) -> Optional[YamlTestFile]: # type: ignore[misc]
154+
def pytest_collect_file(path: py.path.local, parent: Node) -> Optional[YamlTestFile]: # type: ignore[misc]
155155
if path.ext in {".yaml", ".yml"} and path.basename.startswith(("test-", "test_")):
156156
return YamlTestFile.from_parent(parent, fspath=path)
157157
return None

0 commit comments

Comments
 (0)