From 630829e18ca5fa8365027591e0d964045377a18a Mon Sep 17 00:00:00 2001 From: David Stansby Date: Sun, 26 Jan 2025 19:43:20 +0000 Subject: [PATCH 1/2] Make botocore an optional test dependency --- pyproject.toml | 4 +++- tests/test_store/test_fsspec.py | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index e7a1c5c2c4..8d73485dac 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -73,10 +73,12 @@ test = [ "coverage", "pytest", "pytest-cov", + 'zarr[remote]', + "botocore", "s3fs", + "moto[s3,server]", "pytest-asyncio", "pytest-accept", - "moto[s3,server]", "requests", "rich", "mypy", diff --git a/tests/test_store/test_fsspec.py b/tests/test_store/test_fsspec.py index a560ca02e8..929de37869 100644 --- a/tests/test_store/test_fsspec.py +++ b/tests/test_store/test_fsspec.py @@ -5,7 +5,6 @@ from typing import TYPE_CHECKING import pytest -from botocore.session import Session from packaging.version import parse as parse_version import zarr.api.asynchronous @@ -26,6 +25,7 @@ requests = pytest.importorskip("requests") moto_server = pytest.importorskip("moto.moto_server.threaded_moto_server") moto = pytest.importorskip("moto") +botocore = pytest.importorskip("botocore") # ### amended from s3fs ### # test_bucket_name = "test" @@ -52,7 +52,7 @@ def s3_base() -> Generator[None, None, None]: def get_boto3_client() -> botocore.client.BaseClient: # NB: we use the sync botocore client for setup - session = Session() + session = botocore.session.Session() return session.create_client("s3", endpoint_url=endpoint_url) From d524094947cc417cfe30f98e8f925ed89e67140a Mon Sep 17 00:00:00 2001 From: David Stansby Date: Tue, 28 Jan 2025 10:20:11 +0000 Subject: [PATCH 2/2] Add release notes --- changes/2768.bugfix.1.rst | 1 + changes/2768.bugfix.2.rst | 2 ++ 2 files changed, 3 insertions(+) create mode 100644 changes/2768.bugfix.1.rst create mode 100644 changes/2768.bugfix.2.rst diff --git a/changes/2768.bugfix.1.rst b/changes/2768.bugfix.1.rst new file mode 100644 index 0000000000..b732b742ef --- /dev/null +++ b/changes/2768.bugfix.1.rst @@ -0,0 +1 @@ +Updated the optional test dependencies to include ``botocore`` and ``fsspec``. diff --git a/changes/2768.bugfix.2.rst b/changes/2768.bugfix.2.rst new file mode 100644 index 0000000000..1bf5fb8a85 --- /dev/null +++ b/changes/2768.bugfix.2.rst @@ -0,0 +1,2 @@ +Fixed the fsspec tests to skip if ``botocore`` is not installed. +Previously they would have failed with an import error.