|
14 | 14 |
|
15 | 15 | from ..conftest import endpoint_url, test_bucket_name |
16 | 16 |
|
17 | | -# s3fs = pytest.importorskip("s3fs") |
18 | | -# requests = pytest.importorskip("requests") |
19 | | -# moto_server = pytest.importorskip("moto.moto_server.threaded_moto_server") |
20 | | -# moto = pytest.importorskip("moto") |
21 | | - |
22 | | -# # ### amended from s3fs ### # |
23 | | -# test_bucket_name = "test" |
24 | | -# secure_bucket_name = "test-secure" |
25 | | -# port = 5555 |
26 | | -# endpoint_url = f"http://127.0.0.1:{port}/" |
27 | | - |
28 | | - |
29 | | -# @pytest.fixture(scope="module") |
30 | | -# def s3_base() -> Generator[None, None, None]: |
31 | | -# # writable local S3 system |
32 | | - |
33 | | -# # This fixture is module-scoped, meaning that we can reuse the MotoServer across all tests |
34 | | -# server = moto_server.ThreadedMotoServer(ip_address="127.0.0.1", port=port) |
35 | | -# server.start() |
36 | | -# if "AWS_SECRET_ACCESS_KEY" not in os.environ: |
37 | | -# os.environ["AWS_SECRET_ACCESS_KEY"] = "foo" |
38 | | -# if "AWS_ACCESS_KEY_ID" not in os.environ: |
39 | | -# os.environ["AWS_ACCESS_KEY_ID"] = "foo" |
40 | | - |
41 | | -# yield |
42 | | -# server.stop() |
43 | | - |
44 | | - |
45 | | -# def get_boto3_client() -> botocore.client.BaseClient: |
46 | | -# # NB: we use the sync botocore client for setup |
47 | | -# session = Session() |
48 | | -# return session.create_client("s3", endpoint_url=endpoint_url) |
49 | | - |
50 | | - |
51 | | -# @pytest.fixture(autouse=True) |
52 | | -# def s3(s3_base: None) -> Generator[s3fs.S3FileSystem, None, None]: |
53 | | -# """ |
54 | | -# Quoting Martin Durant: |
55 | | -# pytest-asyncio creates a new event loop for each async test. |
56 | | -# When an async-mode s3fs instance is made from async, it will be assigned to the loop from |
57 | | -# which it is made. That means that if you use s3fs again from a subsequent test, |
58 | | -# you will have the same identical instance, but be running on a different loop - which fails. |
59 | | - |
60 | | -# For the rest: it's very convenient to clean up the state of the store between tests, |
61 | | -# make sure we start off blank each time. |
62 | | - |
63 | | -# https://github.com/zarr-developers/zarr-python/pull/1785#discussion_r1634856207 |
64 | | -# """ |
65 | | -# client = get_boto3_client() |
66 | | -# client.create_bucket(Bucket=test_bucket_name, ACL="public-read") |
67 | | -# s3fs.S3FileSystem.clear_instance_cache() |
68 | | -# s3 = s3fs.S3FileSystem(anon=False, client_kwargs={"endpoint_url": endpoint_url}) |
69 | | -# session = sync(s3.set_session()) |
70 | | -# s3.invalidate_cache() |
71 | | -# yield s3 |
72 | | -# requests.post(f"{endpoint_url}/moto-api/reset") |
73 | | -# client.close() |
74 | | -# sync(session.close()) |
75 | | - |
76 | | - |
77 | | -# # ### end from s3fs ### # |
78 | | - |
79 | 17 |
|
80 | 18 | async def test_basic() -> None: |
81 | 19 | store = RemoteStore.from_url( |
|
0 commit comments