Repository navigation
test: ignore pytest-asyncio loop scope deprecation warning under pytest 9.2 - #18879
Open
chalmerlowe wants to merge 1 commit into
Open
chalmerlowe wants to merge 1 commit into
chalmerlowe wants to merge 1 commit into
Conversation
Contributor
There was a problem hiding this comment.
Code Review
This pull request adds a pytest warning filter across multiple packages to ignore deprecation warnings about the unset "asyncio_default_fixture_loop_scope" configuration option. The reviewer recommends using a wildcard pattern (".asyncio_default_fixture_loop_scope.") instead of the exact warning string. This improvement makes the filters more robust against future upstream wording changes and simplifies the TOML configuration by eliminating the need to escape double quotes.
chalmerlowe
force-pushed
the
test/ignore-pytest-asyncio-loop-scope-warning
branch
4 times, most recently
from
October 28, 2026 01:47
118db24 to
9129eed
Compare
chalmerlowe
force-pushed
the
test/ignore-pytest-asyncio-loop-scope-warning
branch
from
October 28, 2026 08:39
9129eed to
d93d529
Compare
chalmerlowe
marked this pull request as ready for review
October 28, 2026 10:59
This branch has not been deployed
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.
Problem / Context
In
pytest9.2.0, three upstream changes break CI across packages in this repository:Config._do_configure()applies configured warning filters (filterwarningsfrompytest.iniorpyproject.toml) insideself._catch_configured_warnings()before invokingself.hook.pytest_configure.call_historic(...). Whenpytest-asynciois installed in the test environment (either directly by a package or via the sharedNOX_ENVDIRvirtual environment in CI), itspytest_configurehook emits:Under
filterwarnings = error,pytest9.2.0 promotes thispytest_configurehook warning into an immediateINTERNALERRORstartup failure (exit code 3).pytest9.2.0 emitspytest.PytestRemovedIn10Warning: Module-scoped fixtures defined as instance methods are deprecated(a subclass ofPytestDeprecationWarning), which causespackages/google-auth-httplib2tests (RequestResponseTests.serverintests/compliance.py) to fail underfilterwarnings = error.pytest9.2.0 renamedFixtureManager._arg2fixturedefsto_arg2node2fixturedefs. Becausepackages/google-cloud-firestore/noxfile.pypinnedpytest-asyncio==0.21.2, test collection inpackages/google-cloud-firestorefails withAttributeError: 'FixtureManager' object has no attribute '_arg2fixturedefs'.Solution
ignore:.*asyncio_default_fixture_loop_scope.*:pytest.PytestDeprecationWarningtofilterwarningsacross all 13 packages in the repository that setfilterwarnings = error.ignore:.*Module-scoped fixtures defined as instance methods are deprecated.*:pytest.PytestDeprecationWarningtopackages/google-auth-httplib2/pytest.ini.pytest-asyncio==0.21.2inpackages/google-cloud-firestore/noxfile.py(and remove the corresponding post-processing rule in.librarian/generator-input/client-post-processing/firestore-integration.yaml):TestAsyncBundle.test_async_query(packages/google-cloud-firestore/tests/unit/v1/test_bundle.py) andtest_baseclient__emulator_channel(packages/google-cloud-firestore/tests/unit/v1/test_base_client.py) sincepytest-asyncio >= 0.23.0clears the thread event loop on teardown.def event_loop():fixture override inpackages/google-cloud-firestore/tests/system/test_system_async.pyandpackages/google-cloud-firestore/tests/system/test_pipeline_acceptance.pywithloop_scope="module"so module-scopedAsyncClientfixtures share a module-scoped event loop underpytest-asyncio >= 1.0.Notes for Reviewers
Using a
filterwarningsignore rule rather than settingasyncio_default_fixture_loop_scope = functioninpytest.inipreserves compatibility with test sessions wherepytest-asynciois not installed (such asgoogle-api-coresessions withinstall_async_rest=False) or where older versions ofpytest-asyncioare used, avoidingPytestConfigWarning: Unknown config option: asyncio_default_fixture_loop_scopeunderfilterwarnings = error.