Skip to content
Merged
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
6 changes: 4 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,9 @@ ignore = [
python_version = "3.12"
ignore_missing_imports = true
namespace_packages = false

pretty = true
show_error_code_links = true
show_error_context = true
strict = true
warn_unreachable = true
enable_error_code = ["ignore-without-code", "redundant-expr", "truthy-bool"]
Expand All @@ -378,7 +380,6 @@ module = [
"tests.test_config",
"tests.test_store.test_zip",
"tests.test_store.test_local",
"tests.test_store.test_fsspec",
"tests.test_store.test_memory",
"tests.test_codecs.test_codecs",
"tests.test_metadata.*",
Expand All @@ -394,6 +395,7 @@ strict = false
# and fix the errors
[[tool.mypy.overrides]]
module = [
"tests.test_store.test_fsspec",
"tests.test_group",
"tests.test_indexing",
"tests.test_properties",
Expand Down
17 changes: 15 additions & 2 deletions tests/test_store/test_fsspec.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,13 @@ def s3_base() -> Generator[None, None, None]:
def get_boto3_client() -> botocore.client.BaseClient:
# NB: we use the sync botocore client for setup
session = botocore.session.Session()
return session.create_client("s3", endpoint_url=endpoint_url)

# Prevent IllegalLocationConstraintException by explicitly setting region to
# "us-east-1", which does not require configuring LocationConstraint during
# bucket creation. (It is, in fact, forbidden for that region.) Necessary
# in the face of "ambient" AWS configuration in a development environment
# where the default region might be configured differently.
return session.create_client("s3", endpoint_url=endpoint_url, region_name="us-east-1")


@pytest.fixture(autouse=True)
Expand All @@ -100,7 +106,14 @@ def s3(s3_base: None) -> Generator[s3fs.S3FileSystem, None, None]:
client = get_boto3_client()
client.create_bucket(Bucket=test_bucket_name, ACL="public-read")
s3fs.S3FileSystem.clear_instance_cache()
s3 = s3fs.S3FileSystem(anon=False, client_kwargs={"endpoint_url": endpoint_url})
s3 = s3fs.S3FileSystem(
anon=False,
client_kwargs={"endpoint_url": endpoint_url},
# Prevent "AssertionError: Session was never entered" from aiobotocore
# at end of test execution. Using clear_instance_cache is insufficient,
# although still necessary.
skip_instance_cache=True,
)
session = sync(s3.set_session())
s3.invalidate_cache()
yield s3
Expand Down
Loading