fix(test): add @pytest.mark.asyncio to allowlist test class - #110
Open
github-actions[bot] wants to merge 1 commit into
Open
fix(test): add @pytest.mark.asyncio to allowlist test class#110github-actions[bot] wants to merge 1 commit into
github-actions[bot] wants to merge 1 commit into
Conversation
pytest.ini uses [tool:pytest] header which is not recognized by pytest.ini files (only setup.cfg uses that header), so asyncio_mode=auto is silently ignored and pytest-asyncio defaults to STRICT mode. In STRICT mode every async test must carry an explicit @pytest.mark.asyncio marker. Adds the class-level decorator so all four async methods in TestUpdateColumnAllowlist are handled by pytest-asyncio. Fixes the test-backend failure introduced by commit 77eb667 (part 3 of the Bandit security hardening), which added this test file without the marker. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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.
Root cause
PR #98 added
test_database_update_allowlist.py(commit 77eb667) as part of the Bandit security hardening work. That commit fixed thesecurity-scanjob (all 23 remaining Bandit findings were annotated or code-fixed), but introduced a newtest-backendfailure.The test file defines four async test methods in a class without
@pytest.mark.asyncio. Thepytest.inifile attempts to setasyncio_mode = autovia--asyncio-mode=autoinaddoptsandasyncio_mode = autoas an ini option — but uses a[tool:pytest]section header, which is only valid insetup.cfg, notpytest.ini. pytest silently ignores those settings, sopytest-asynciofalls back to its STRICT default mode. In STRICT mode every async test must carry an explicit@pytest.mark.asynciomarker; without it, pytest tries to run the coroutine as a plain function and emits:Fix
Added
@pytest.mark.asyncioas a class-level decorator onTestUpdateColumnAllowlist. This makes all four async test methods in that class visible topytest-asyncioin STRICT mode without touching any other tests or configuration.@pytest.mark.database +@pytest.mark.asyncio class TestUpdateColumnAllowlist:No other code changed — this is a one-line, targeted fix to the CI regression introduced alongside the Bandit hardening.
Closes the remaining CI failure on #98.
Co-Authored-By: Claude Sonnet 4.6 noreply@anthropic.com