Repository navigation
test: make test_sleep_manager.py runnable under pytest via pytest-asyncio - #432
Merged
RixinLiu merged 1 commit intoAug 13, 2026
Conversation
…ncio pytest collected the async def tests but failed them all (no async plugin) and resolved the script-style manager parameter as a nonexistent fixture, so controller/sleep_manager.py had zero automated coverage and async behavior could only be tested through asyncio.run() workarounds. Add pytest-asyncio with asyncio_mode=auto, provide a manager fixture, make each step self-contained (tests register their own models and degrade gracefully with no live server), and convert deterministic prints into assertions. The live-server script mode is unchanged. Since the file no longer needs live vLLM/SGLang endpoints, move it from the integration manifest to the cpu manifest added in ovg-project#403, which adds 9 tests to the CPU CI run. tools/check_test_classification.py reports total=26, cpu=16, gpu=5, integration=5. Fixes ovg-project#431
rishabhsinha17
force-pushed
the
test/pytest-asyncio-sleep-manager
branch
from
August 12, 2026 01:19
befcc92 to
50debbd
Compare
Collaborator
Author
|
Rebased onto main and folded in the manifest side of this, now that #403 has landed.
Closed #428 in favor of #403; this is the part that did not overlap. |
Collaborator
|
LGTM |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Make
tests/test_sleep_manager.pyactually runnable under pytest:9 passedwhere every environment previously got1 failed, 8 errors.Fixes #431.
Problem
The file is written as a sequential live-server script (
main()shares oneSleepManageracross steps), but pytest also collects itsasync def test_*functions. Without an async plugin the first test fails with "async def functions are not natively supported", and the step functions'managerparameter is resolved as a nonexistent fixture, erroring the other eight. As a resultcontroller/sleep_manager.pyhas zero automated coverage, and async behavior has to be tested through workarounds — #409 wrapsasyncio.gatherinasyncio.run()inside a sync test for exactly this reason.Changes
pytest-asynciotorequirements.txtand configureasyncio_mode = "auto"inpyproject.toml, so plainasync deftests and fixtures run without per-test markers (and future PRs like fix(controller): don't fail the losing racer of a concurrent wakeup_model() call #409 can write native async tests)managerfixture providing a freshSleepManagerper test;main()keeps its own shared manager, so the live-server script mode is unchangedexample-config.yamlinstead of relying on state left behind by earlier steps (SleepManager's HTTP helpers already catch connection failures and returnFalse, so these degrade gracefully and quickly when no live endpoint is reachable; the fresh-manager path previously crashed withTypeError: argument of type 'NoneType' is not iterablein the SGLang detection step)_call_vllm_wake_apiandhandle_model_wakeupprintedFalseand could never fail; the assertions now cover the real_call_vllm_wakeup_apiandhandle_model_wakeup_on_requestValidation
The full CPU-only suite passes with
asyncio_mode = "auto"enabled (82 passed, 1 skipped — the 73 previously-passing tests plus these 9). No live vLLM/SGLang endpoints are required; with servers configured, the script path exercises the real sleep/wake cycle exactly as before.ruff check,isort --check-only, and mypy pass on the changed files.Once this and #428 (or #403) land, the CPU CI job can stop excluding this file.