What the agent does
The agent clones the repository into its own cloud sandbox and reads where the old decorator is used. In a pytest plugin like pytest-dev/pytest-services, which starts memcached, MySQL and Xvfb for a test session, setup.py requires requests, psutil, pytest and zc.lockfile, with python_requires=">=3.9", and .github/workflows/test.yml runs the suite on Python 3.9 through 3.14. A search for yield_fixture finds exactly two uses, both in pytest_services/folders.py: @pytest.yield_fixture(scope='session') on base_dir at line 15 and on memory_base_dir at line 55, next to 36 other fixtures in the package that already use @pytest.fixture. tests/test_plugin.py holds six tests, and tests/conftest.py enables pytester.
Then it runs the suite twice. With the current pytest, 9.2.0 today, pytest tests reports 4 passed and 2 errors, the errors being test_memcached and test_mysql, which need pylibmc and MySQLdb from requirements-testing.txt and fail in the sandbox with You have to install messages the agent records as the baseline. The warnings summary prints PytestRemovedIn10Warning: @pytest.yield_fixture is deprecated. Use @pytest.fixture instead; they are the same. twice, once per line. Run with -W error::DeprecationWarning, which many projects set in filterwarnings, the plugin fails to import at folders.py:15 before a single test is collected, because PytestRemovedIn10Warning is a DeprecationWarning. On pytest 7.4 and 6.2 the same text arrives as PytestDeprecationWarning, so the fix is the same whichever release a project pins.
The fix is two words: @pytest.yield_fixture(scope='session') becomes @pytest.fixture(scope='session') on both lines. A fixture body that uses yield has been handled by the plain decorator since pytest 3.0, so the fixtures' setup and teardown are unchanged. After the edit pytest tests reports the same 4 passed and 2 errors with no warnings, and the -W error::DeprecationWarning run gets through import and collection to the same two environment-only errors.
It leaves the rest alone and says so: the two errors need services the sandbox does not have and are the same before and after, so they are not part of the change; CHANGES.rst gets a one-line entry under the unreleased section, matching the entries the file already has; and the pytest requirement is left unpinned because the plain decorator works on every release the CI matrix runs.
Start it with one API call
POST https://api.phoenix.so/o/{org}/sessions with this body:
{
"agent": "claude",
"input": "Replace every use of @pytest.yield_fixture with @pytest.fixture. List each occurrence with its file and line first. Run the test suite on the current pytest and quote the deprecation warning text, then run it with -W error::DeprecationWarning and quote what fails. Make the replacement, keeping each fixture's scope, autouse and name arguments exactly as they are, and run both commands again to show the same tests pass with no warning. Record which failures, if any, are unrelated to the change and the same before and after. Add a changelog line if the repository keeps one. Open a pull request that quotes all four runs.",
"resources": [
{
"url": "https://github.com/your-org/your-app"
}
]
}- Get an API key. In the console, open Settings, then API keys, and create a key for your org. Send it in the Authorization header as a Bearer token.
- Send the request. POST the body in request.json to https://api.phoenix.so/o/{org}/sessions, with your repository as the resources URL. The run starts in its own cloud sandbox.
- Read what came back. Follow the run on its live stream or wait for the run.completed webhook, then read the result and its trajectory.
What comes back
What comes back is a pull request touching pytest_services/folders.py and CHANGES.rst: two decorators renamed with their scope='session' arguments intact, and one changelog line. The description lists the two lines, quotes @pytest.yield_fixture is deprecated. Use @pytest.fixture instead; they are the same. from the warnings summary, shows the -W error run failing at import before the change and collecting after it, and marks the memcached and MySQL errors as the same environment failures on both sides.
A reviewer checks that both fixtures kept their scope, that no other fixture in the package changed, and that the test counts match before and after. The run's record holds all four pytest runs with their full output, so the warning and its absence can be read rather than taken on trust.
Run it on every pull request labelled dependencies
The warning usually arrives with a pytest bump. Add an automation to the repository's Project with a github trigger on pull_request.labeled, its labels filter set to dependencies, and this prompt. When a dependency bot's pytest bump is labelled, the run starts with the pull request event placed after the prompt, runs the suite on that branch and opens its own pull request with the decorator replacement, which you merge ahead of the bump; a bump of another package ends with a report and no change.
The trigger fires only for labels applied by an owner, member or collaborator, never for pull requests from forks, and the automation's max_runs_per_hour caps how often it starts.
The use case this job follows, with its automation and trigger: Upgrade dependencies weekly.
Why run it on Rush?
A warning in the summary scrolls past for years, and a project that one day sets filterwarnings = error finds its plugin cannot even import. The agent runs the suite under both filters in its own sandbox and quotes the point of failure, so the pull request shows why the rename matters now, and every run stays in the record.
The change is trivial; the proof that it is complete is not. Because the agent lists every yield_fixture first and reruns the suite on the same release, the pull request shows that the count of warnings went to zero and that the only remaining errors are ones the sandbox owns.
Frequently asked questions
What is the difference between yield_fixture and fixture?
None since pytest 3.0, when @pytest.fixture learned to treat a yield in the body as the split between setup and teardown. yield_fixture stayed as an alias, was deprecated in 6.2, and pytest 10 removes it, which is what the PytestRemovedIn10Warning name means.
Why does the -W error run fail before any test runs?
Because the decorator is evaluated when the module is imported, and pytest's deprecation warnings subclass DeprecationWarning. Under -W error::DeprecationWarning the warning becomes an exception at import time, so a plugin or conftest with the old decorator stops the whole collection.
Will the fixtures' teardown still run?
Yes. The code after yield in each fixture runs at the end of the scope exactly as before; only the decorator name changes. The suite rerun after the edit is the check, and the agent keeps scope='session' on both fixtures.
What if my repository has yield_fixture in conftest files as well?
The agent's first step is a list of every occurrence under the repository, conftest files and plugins included, so the pull request covers all of them in one change. Each replacement is the same rename, and the suite run after it shows no warning remains.