Skip to content

Commit 27f6edd

Browse files
authored
Replace pkg_resources with packaging for Python 3.12 compatibility. (#112)
* Replace pkg_resources with packaging for Python 3.12 compatibility. * Add Python 3.11 to CI testing. * Formatting fix.
1 parent 2459905 commit 27f6edd

File tree

3 files changed

+4
-3
lines changed

3 files changed

+4
-3
lines changed

.github/workflows/test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313

1414
strategy:
1515
matrix:
16-
python-version: ["3.7", "3.8", "3.9", "3.10"]
16+
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"]
1717
# TODO: remove `7.1` in the next release
1818
pytest-version: ["~=6.2", "~=7.1", "~=7.2"]
1919

pytest_mypy_plugins/collect.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,12 @@
1515
Set,
1616
)
1717

18-
import pkg_resources
1918
import py.path
2019
import pytest
2120
import yaml
2221
from _pytest.config.argparsing import Parser
2322
from _pytest.nodes import Node
23+
from packaging.version import Version
2424

2525
from pytest_mypy_plugins import utils
2626

@@ -152,7 +152,7 @@ def _eval_skip(self, skip_if: str) -> bool:
152152
return eval(skip_if, {"sys": sys, "os": os, "pytest": pytest, "platform": platform})
153153

154154

155-
if pkg_resources.parse_version(pytest.__version__) >= pkg_resources.parse_version("7.0.0rc1"):
155+
if Version(pytest.__version__) >= Version("7.0.0rc1"):
156156

157157
def pytest_collect_file(file_path: pathlib.Path, parent: Node) -> Optional[YamlTestFile]:
158158
if file_path.suffix in {".yaml", ".yml"} and file_path.name.startswith(("test-", "test_")):

setup.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
"pyyaml",
1111
"chevron",
1212
"regex",
13+
"packaging",
1314
]
1415

1516
setup(

0 commit comments

Comments
 (0)