From 179a0502ea61d5baaa6068f318e14f2264d8d50c Mon Sep 17 00:00:00 2001 From: Adam Dangoor Date: Sat, 14 Jun 2025 21:46:54 +0100 Subject: [PATCH 1/2] More switch to IO --- tests/conftest.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/conftest.py b/tests/conftest.py index 3831755a..99ed568f 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -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 @@ -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. """ @@ -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. From 601d9c6253fbb5f3e76fe313eab3ca0b72f60201 Mon Sep 17 00:00:00 2001 From: Adam Dangoor Date: Sat, 14 Jun 2025 21:47:46 +0100 Subject: [PATCH 2/2] Better formatting --- conftest.py | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/conftest.py b/conftest.py index 1d776f8d..a319285e 100644 --- a/conftest.py +++ b/conftest.py @@ -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. @@ -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.