Skip to content

fix(test): add @pytest.mark.asyncio to allowlist test class - #110

Open
github-actions[bot] wants to merge 1 commit into
fix/sec-83-banditfrom
claude-auto-fix-ci-fix/sec-83-bandit-30052687595
Open

fix(test): add @pytest.mark.asyncio to allowlist test class#110
github-actions[bot] wants to merge 1 commit into
fix/sec-83-banditfrom
claude-auto-fix-ci-fix/sec-83-bandit-30052687595

Conversation

@github-actions

Copy link
Copy Markdown
Contributor

Root cause

PR #98 added test_database_update_allowlist.py (commit 77eb667) as part of the Bandit security hardening work. That commit fixed the security-scan job (all 23 remaining Bandit findings were annotated or code-fixed), but introduced a new test-backend failure.

The test file defines four async test methods in a class without @pytest.mark.asyncio. The pytest.ini file attempts to set asyncio_mode = auto via --asyncio-mode=auto in addopts and asyncio_mode = auto as an ini option — but uses a [tool:pytest] section header, which is only valid in setup.cfg, not pytest.ini. pytest silently ignores those settings, so pytest-asyncio falls back to its STRICT default mode. In STRICT mode every async test must carry an explicit @pytest.mark.asyncio marker; without it, pytest tries to run the coroutine as a plain function and emits:

async def functions are not natively supported.
You need to install a suitable plugin for your async framework...

Fix

Added @pytest.mark.asyncio as a class-level decorator on TestUpdateColumnAllowlist. This makes all four async test methods in that class visible to pytest-asyncio in 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

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>
@github-actions
github-actions Bot requested a review from izzywdev as a code owner July 23, 2026 23:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants