Skip to content

Commit

Permalink
Add compat for old pytest in type hints
Browse files Browse the repository at this point in the history
  • Loading branch information
dlax committed Oct 6, 2023
1 parent 5932782 commit 0075e45
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def get_version() -> str:
],
extras_require={
"test": [
"pytest",
"pytest >= 6.0.2",
],
},
entry_points={
Expand Down
7 changes: 6 additions & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@

from . import PatroniAPI

if tuple(int(v) for v in pytest.__version__.split(".", 2)) >= (6, 2):
TempPathFactory = pytest.TempPathFactory
else:
from _pytest.tmpdir import TempPathFactory # type: ignore[no-redef]


@pytest.fixture(
params=[False, True],
Expand All @@ -23,7 +28,7 @@ def datadir() -> Path:

@pytest.fixture(scope="session")
def patroni_api(
tmp_path_factory: pytest.TempPathFactory, datadir: Path
tmp_path_factory: TempPathFactory, datadir: Path
) -> Iterator[PatroniAPI]:
"""A fake HTTP server for the Patroni API serving files from a temporary
directory.
Expand Down

0 comments on commit 0075e45

Please sign in to comment.