Skip to content

Commit bd5eb13

Browse files
committed
send s3fs fixture to remotestore fixture
1 parent 0219425 commit bd5eb13

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

tests/conftest.py

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737

3838

3939
async def parse_store(
40-
store: str, path: str, s3_base: str
40+
store: str, path: str, s3: s3fs.S3FileSystem
4141
) -> LocalStore | MemoryStore | RemoteStore | ZipStore:
4242
"""
4343
Take a string representation of a store + access mode, e.g. 'local_a', which would encode
@@ -61,11 +61,7 @@ async def parse_store(
6161
case "memory":
6262
return await MemoryStore.open(mode=mode)
6363
case "remote":
64-
return RemoteStore.from_url(
65-
f"s3://{test_bucket_name}/foo/spam/",
66-
mode=mode,
67-
storage_options={"endpoint_url": s3_base, "anon": False},
68-
)
64+
return await RemoteStore.open(fs=s3, path=test_bucket_name, mode=mode)
6965
case "zip":
7066
return await ZipStore.open(path + "/zarr.zip", mode=mode)
7167
raise AssertionError
@@ -84,9 +80,11 @@ async def store_path(tmpdir: LEGACY_PATH) -> StorePath:
8480

8581

8682
@pytest.fixture
87-
async def store(request: pytest.FixtureRequest, tmpdir: LEGACY_PATH, s3_base: str) -> Store:
83+
async def store(
84+
request: pytest.FixtureRequest, tmpdir: LEGACY_PATH, s3: s3fs.S3FileSystem
85+
) -> Store:
8886
param = request.param
89-
return await parse_store(param, str(tmpdir), s3_base)
87+
return await parse_store(param, str(tmpdir), s3)
9088

9189

9290
@pytest.fixture(params=["local", "memory", "zip"])
@@ -204,7 +202,7 @@ def s3(s3_base: str) -> Generator[s3fs.S3FileSystem, None, None]: # type: ignor
204202
client = get_boto3_client(s3_base)
205203
client.create_bucket(Bucket=test_bucket_name, ACL="public-read")
206204
s3fs.S3FileSystem.clear_instance_cache()
207-
s3 = s3fs.S3FileSystem(anon=False, client_kwargs={"endpoint_url": s3_base})
205+
s3 = s3fs.S3FileSystem(anon=False, client_kwargs={"endpoint_url": s3_base}, asynchronous=True)
208206
session = sync(s3.set_session())
209207
s3.invalidate_cache()
210208
yield s3

0 commit comments

Comments
 (0)