Test: declare the computer_use tool_context fixture with pytest_asyncio.fixture - #177
Open
AmaadMartin wants to merge 1 commit into
Open
Test: declare the computer_use tool_context fixture with pytest_asyncio.fixture#177AmaadMartin wants to merge 1 commit into
AmaadMartin wants to merge 1 commit into
Conversation
…io.fixture tool_context is a coroutine fixture declared with @pytest.fixture. It only works because the repo sets asyncio_mode = auto in pyproject.toml. Under pytest --asyncio-mode=strict, pytest-asyncio does not adopt it and its 9 consumers in TestComputerUseTool error at setup. Declaring it with @pytest_asyncio.fixture states the intent in the module itself, matching tests/unittests/tools/test_local_environment.py and the two tests/unittests/tools/environment/ modules.
This was referenced Aug 8, 2026
Open
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.
Please ensure you have read the contribution guide before creating a pull request.
Link to Issue or Description of Change
N/A
Problem:
TestComputerUseTool.tool_contextis a coroutine fixture declared with@pytest.fixture. It only works because this repo setsasyncio_mode = "auto"inpyproject.toml. Underpytest --asyncio-mode=strict, pytest-asyncio does not adopt the fixture, so its 9 consumers error at setup with "requested an async fixture 'tool_context', with no plugin or hook that handled it".Solution: I declared the fixture with
@pytest_asyncio.fixture. The module now states its own async intent instead of depending onpyproject.toml. This matchestests/unittests/tools/test_local_environment.pyand the twotests/unittests/tools/environment/modules, which already use@pytest_asyncio.fixture.pytest-asynciois already a declared test dependency (pyproject.toml), so no dependency changes.Collision check: I listed the 100 open PRs on this fork and checked every plausibly adjacent one. Only #168 touches this file, and it removes an unused function-local import about 460 lines away. There is no overlap, so this branch starts from
main.Testing Plan
Environment: pytest 9.1.1, pytest-asyncio 1.4.0, Python 3.13.14.
Before the change:
pytest tests/unittests/tools/computer_use -qpytest tests/unittests/tools/computer_use -q --asyncio-mode=strictAfter the change:
pytest tests/unittests/tools/computer_use -qpytest tests/unittests/tools/computer_use -q --asyncio-mode=strictpytest tests/unittests/tools/computer_use -q --asyncio-mode=strict -W error::pytest.PytestWarningThe last run proves that no
PytestWarningreplaced the setup error.Mutation check: I reverted the decorator to
@pytest.fixtureand kept the new import. Strict mode returned to65 passed, 3 warnings, 9 errors, with all 9 errors namingtool_context. The changed line is what fixes the failure.Static check: an AST scan for
async deffunctions decorated with@pytest.fixturereports zero hits intests/unittests/tools/computer_use.Formatting:
isort==8.0.1andpyink==25.12.0(the pinned pre-commit versions) both leave the file unchanged.This change adds no product code, so there is no new line to cover. The coverage obligation is met by the 9 previously-erroring tests now executing and passing in both asyncio modes.
Unit Tests:
Manual End-to-End (E2E) Tests:
Run the two commands below from the repo root. They must report the same counts and no errors.
Checklist
CI note
All test jobs pass: Unit Tests on Python 3.10 to 3.14, A2A v0.3 Tests on 3.10 to 3.14, and Mypy Check on 3.10 to 3.13.
Pre-commit Linterfails on theupdate-constraintshook. That hook regeneratesconstraints-*.txtwith a fresh--exclude-newerdate, so it fails on every run. It already fails onmainat this branch's base commit352d11d3. This diff touches nopyproject.tomland no constraints file, so the failure is unrelated. PR #163 covers that hook.