Skip to content

Mock buckets

FakeBucketRegistry

FakeBucketRegistry()

Small registry used by FakeMutableBucket for S3-to-S3 copies.

FakeMutableBucket

FakeMutableBucket(bucket_name: str, *, registry: FakeBucketRegistry | None = None, files: dict[str, bytes | str] | None = None, client: Any = None, resource: Any = None, session: Any = None, config: Any = None, n_threads: int = 4)

Bases: MockBucket

Minimal mutable in-memory Bucket double for upload client / validation server tests.

FakeReadOnlyDataBucket

FakeReadOnlyDataBucket(bucket_name: str, client: Any = None, resource: Any = None, session: Any = None, config: Any = None, n_threads: int = 4)

Bases: MockBucket

Mock S3 bucket for testing S3Reader. Implements just the subset of the hostess.aws.s3.Bucket API that is used by S3Reader. The bucket name is ignored. File names of the form "{dtype}-{length}", where {dtype} is a NumPy scalar dtype code and {length} is a decimal number that is a multiple of the size of {dtype}, will contain exactly {length} bytes of data, consisting of sequential values of {dtype}; all other filenames are reported as nonexistent.

MockBucket

MockBucket(bucket_name: str, *, client: Any = None, resource: Any = None, session: Any = None, config: Any = None, n_threads: int = 4)

Bases: Bucket

Mock S3 bucket base class, for testing. The constructor rejects the client, resource, session, and config arguments. The methods throw plausible S3 failure exceptions or return nothing.