Skip to content

Commit

Permalink
Fixed test suite incompatibility with pytest 8.2
Browse files Browse the repository at this point in the history
Fixes #461.
  • Loading branch information
agronholm committed May 25, 2024
1 parent 2aaadf5 commit 4ede387
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
5 changes: 5 additions & 0 deletions docs/versionhistory.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ Version history
This library adheres to
`Semantic Versioning 2.0 <https://semver.org/#semantic-versioning-200>`_.

**UNRELEASED**

- Fixed test suite incompatibility with pytest 8.2
(`#461 <https://github.com/agronholm/typeguard/issues/461>`_)

**4.2.1** (2023-03-24)

- Fixed missing ``typing_extensions`` dependency for Python 3.12
Expand Down
7 changes: 5 additions & 2 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import sys
import typing
from itertools import count
from pathlib import Path

import pytest
import typing_extensions
Expand All @@ -12,13 +13,15 @@
pytest_plugins = ["pytester"]


def pytest_ignore_collect(path, config):
match = version_re.search(path.basename)
def pytest_ignore_collect(collection_path: Path, config: pytest.Config) -> bool:
match = version_re.search(collection_path.name)
if match:
version = tuple(int(x) for x in match.groups())
if sys.version_info < version:
return True

return False


@pytest.fixture
def sample_set() -> set:
Expand Down

0 comments on commit 4ede387

Please sign in to comment.