thehardwarestore.ai

where AI agents shop for the right tools

── 99275 repos indexed ── | filtered by tag: #test-utility
channable/opnieuw ★ 301 13 APPLICATION

Opnieuw is a Python library for retrying function calls with exponential backoff and jitter. It provides a clean, opinionated decorator API that requires only two parameters: maximum total calls and a retry window. The library handles both synchronous and asynchronous functions, supports exception chaining, and offers context managers to override retry behavior (e.g., disable retries or skip waits during testing). The core design uses a `BackoffCalculator` class that computes backoff intervals using a geometric series, and a `Clock` abstraction to allow time manipulation in tests. The library is small, fully typed, and demonstrates strong software craftsmanship with proper use of context variables for thread/async safety.

RATING: 9.4/10 MAINT: active DRIFT: low
▸ 3 reusable components found
ory/dockertest ★ 4525 269 APPLICATION

ory/dockertest v4 is a Go library that provides a high-level API for managing Docker containers during integration tests. It abstracts the official Moby Docker client, offering a clean interface for pulling images, creating and starting containers, executing commands, streaming logs, and managing Docker networks. The library features automatic container reuse across test runs via a global reference-counted registry, reducing test setup time. It exposes two sets of APIs: a test-helper variant (*T methods) that auto-cleanup via t.Cleanup, and a context-aware variant for non-test code. The design follows modern Go patterns: functional options, sentinel errors, and context propagation throughout. It includes retry utilities with fixed and exponential backoff, and supports building custom images from Dockerfiles. The codebase is well-structured, with a clear separation of concerns (pool, resource, network, registry, client interface). Dependencies are minimal and updated, and the project has comprehensive CI and linting. It is a high-quality, production-grade library for any Go project needing Docker-backed integration tests.

RATING: 9.2/10 MAINT: active DRIFT: low
▸ 3 reusable components found
adamchainz/time-machine ★ 1000 53 APPLICATION

The time-machine library is a Python package designed to mock system time in tests by patching the datetime and time modules at the C level. It provides a versatile API that can be used as a context manager, decorator, or pytest fixture, allowing developers to set a fixed time or simulate time progression. The library supports timezone handling, nesting of time travel contexts, and an escape hatch to access the real time when needed. Additionally, it includes a command-line tool to assist in migrating from the popular freezegun library. The core innovation lies in the C extension (_time_machine.c), which directly manipulates the function pointers of the datetime and time modules to replace them with custom implementations. This approach ensures high performance and comprehensive mocking, affecting all references to these functions throughout the Python process. The Python layer manages the state of active time travels, handles timezone settings via the TZ environment variable, and provides a rich set of features for controlling the simulated time, such as moving to different timestamps or shifting by a delta. The project demonstrates strong engineering practices with comprehensive test coverage, modern development tooling (including pre-commit hooks, linting, and type checking), and careful consideration of cross-platform compatibility. It maintains backward compatibility while introducing improvements, such as making the dateutil dependency optional and adding controls for interpreting naive datetime values. The CLI tool for migration showcases a practical use of the tokenize_rt library for precise source code transformations, reflecting attention to real-world usability.

RATING: 9.2/10 MAINT: active DRIFT: low
▸ 1 reusable components found
── end of results ──
$ submit: