Skip to content

Mock s3log

Minimal mocks of s3log objects for upload client & validator tests.

MockS3TSVReader

MockS3TSVReader(bucket: Any, key: str, fields: FieldSpec)

Push-driven mock of S3TSVReader.

crashed property

crashed: bool

Whether the mock reader has been marked crashed.

running property

running: bool

Whether the mock reader is running.

crash

crash(exception: BaseException | None = None) -> None

Mark the reader crashed and optionally make future updates raise.

push

push(rows: DataFrame | Mapping[str, Any] | Sequence[Mapping[str, Any]]) -> None

Queue a batch of parsed log rows for the next update().

rows may be a DataFrame, one mapping, or a sequence of mappings. Missing known fields are filled with empty strings; unknown fields raise, because the real reader would not produce surprise columns.

start

start(*, force: bool = False) -> None

Start the mock reader.

stop

stop() -> None

Stop the mock reader.

update

update() -> bool

Expose one queued batch of log rows, if any.

MockS3TSVWriter

MockS3TSVWriter(bucket: Any, key: str, *, fields: FieldSpec, fixed: Mapping[str, str] | None = None, safe: bool = True, add_timestamps: bool = True, buftime: float = 0.5, shared_lock: Any = None, buf_poll_rate: float = 0.08)

Synchronous, in-memory mock of S3TSVWriter.

stop

stop() -> None

Mark the mock writer stopped.

write

write(**field_values: Any) -> None

Record one log row, applying fixed fields and light validation.