Skip to content

Use more flexible IO typing #2622

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 2 additions & 6 deletions conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,7 @@ def pytest_collection_modifyitems(items: list[pytest.Item]) -> None:


@pytest.fixture(name="make_image_file")
def fixture_make_image_file(
high_quality_image: io.BytesIO,
) -> Generator[None]:
def fixture_make_image_file(high_quality_image: io.BytesIO) -> Generator[None]:
"""Make an image file available in the test directory.

The path of this file matches the path in the documentation.
Expand All @@ -45,9 +43,7 @@ def fixture_make_image_file(


@pytest.fixture(name="mock_vws")
def fixture_mock_vws(
monkeypatch: pytest.MonkeyPatch,
) -> Generator[None]:
def fixture_mock_vws(monkeypatch: pytest.MonkeyPatch) -> Generator[None]:
"""Yield a mock VWS.

The keys used here match the keys in the documentation.
Expand Down
6 changes: 3 additions & 3 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import io
from collections.abc import Generator
from pathlib import Path
from typing import IO, BinaryIO, Literal
from typing import IO, Literal

import pytest
from mock_vws import MockVWS
Expand Down Expand Up @@ -53,7 +53,7 @@ def fixture_image_file(
high_quality_image: io.BytesIO,
tmp_path: Path,
request: pytest.FixtureRequest,
) -> Generator[BinaryIO]:
) -> Generator[IO[bytes]]:
"""
An image file object.
"""
Expand All @@ -69,7 +69,7 @@ def fixture_image_file(
def image(
request: pytest.FixtureRequest,
high_quality_image: io.BytesIO,
image_file: BinaryIO,
image_file: IO[bytes],
) -> IO[bytes]:
"""
An image in any of the types that the API accepts.
Expand Down
Loading