Skip to content

feat: parallel async probe runner (run_probes) (#2)#29

Merged
pardamike merged 1 commit into
mainfrom
feat/async-probe-runner
May 26, 2026
Merged

feat: parallel async probe runner (run_probes) (#2)#29
pardamike merged 1 commit into
mainfrom
feat/async-probe-runner

Conversation

@pardamike

Copy link
Copy Markdown
Owner

Closes #2.

Lets async adapters fan probes out concurrently instead of the serial to_sync path.

Design call

Rather than bundle auto-collected @pytest.mark.asyncio tests (which would force pytest-asyncio on every user under --strict-markers and risk silent false-passes when no async plugin is active, plus double the test surface), this ships a native-async runner + recipe:

  • pytest_wardenbot.runners.run_probes(adapter, prompts, *, concurrency=5) — semaphore-bounded asyncio.gather over send_message, returns per-prompt ProbeResults in input order. WardenBotInfraError is captured per-probe (.error / .ok) so one unreachable bot doesn't sink the batch; non-infra exceptions propagate.
  • Grade results with the same deterministic helpers the sync tests use.
  • [async] extra (pytest-asyncio) + a how-to recipe; base.py's "v0.2 native-async" notes now point here. (Also finally puts the reserved runners/ package to use.)

Tests

tests/test_async_probe.py — 8 tests with stub async adapters: concurrency cap honored (tracks peak in-flight), concurrency=1 is serial, input order preserved, infra error captured without sinking the batch, non-infra exception propagates, empty input, concurrency<1ValueError. 100% coverage of the new module, no API.

Verification

ruff clean · pytest -q382 passed · mkdocs build --strict clean.

Adds pytest_wardenbot.runners.run_probes: fan a corpus out against an
AsyncChatbotAdapter concurrently (semaphore-bounded asyncio.gather), returning
per-prompt ProbeResults in input order. Infra errors are captured per-probe
(.error / .ok) so one unreachable bot doesn't sink the batch; real bugs
propagate.

This is the native-async counterpart to the serial sync tests, delivered as a
runner + recipe rather than auto-collected @pytest.mark.asyncio tests (which
would force pytest-asyncio on all users under --strict-markers and risk silent
false-passes). Grade results with the existing deterministic helpers.

- [async] extra (pytest-asyncio); how-to/parallel-async.md recipe.
- runners/__init__ exports run_probes + ProbeResult; api.md documents them.
- base.py async notes now point at run_probes.
- 8 unit tests via stub async adapters (concurrency cap, order, error capture,
  propagation) -- 100% covered, no API.

Closes #2.
@codecov

codecov Bot commented May 26, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.97%. Comparing base (f39411a) to head (e01c4c4).

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main      #29      +/-   ##
==========================================
+ Coverage   93.82%   93.97%   +0.14%     
==========================================
  Files          41       42       +1     
  Lines        1329     1361      +32     
  Branches      127      128       +1     
==========================================
+ Hits         1247     1279      +32     
  Misses         65       65              
  Partials       17       17              
Flag Coverage Δ
unittests 93.97% <100.00%> (+0.14%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
src/pytest_wardenbot/adapters/base.py 82.60% <ø> (ø)
src/pytest_wardenbot/runners/__init__.py 100.00% <100.00%> (ø)
src/pytest_wardenbot/runners/async_probe.py 100.00% <100.00%> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@pardamike pardamike merged commit a262917 into main May 26, 2026
10 checks passed
@pardamike pardamike deleted the feat/async-probe-runner branch May 26, 2026 14:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(v0.2): native-async shipped tests for parallel probe fan-out

1 participant