Integration tests inject httpx2.MockTransport into the production httpware.Client so the GitLab provider can be exercised end-to-end without a real GitLab.
Two seams exist, depending on the test entry point:
- CLI-level tests (
test_cli_*.py) drivesemvertag.__main__through Typer'sCliRunnerand let the DI container build the production stack. They overrideioc.ProvidersGroup.gitlab_clientwith a mock-backedhttpware.Clientvia theinstall_mock_transportfixture inconftest.py. - Provider-level tests (
test_gitlab_provider.py) bypass the container and call the_make_provider(handler)helper, which constructs anhttpware.Client(httpx2_client=httpx2.Client(transport=httpx2.MockTransport(handler), base_url=...))directly.
Retry-exhaustion paths (test_raises_provider_api_error_on_5xx, ..._on_429, the exit-4 cases in test_cli_quiet_json_matrix.py) would otherwise wait on httpware.Retry's full-jitter backoff. The standard fix is to monkeypatch the stdlib sleep used by httpware.middleware.resilience.retry:
monkeypatch.setattr(time, "sleep", lambda *_a, **_k: None)Patching the global time.sleep is equivalent to patching httpware.middleware.resilience.retry.time.sleep because that module imports time and references time.sleep via the module attribute. If a future httpware refactor changes the binding shape (e.g. from time import sleep), this monkeypatch will silently break — tests will pass but take seconds longer.
If httpware.Retry ever grows an injectable _sleep parameter, prefer that over the monkeypatch — it closes the coupling.