Skip to content

fix(tests): mark the review-coverage async tests so they run in the docker test image - #2604

Closed
IsmaelMartinez wants to merge 1 commit into
The-PR-Agent:mainfrom
IsmaelMartinez:fix/asyncio-marker-review-coverage
Closed

IsmaelMartinez wants to merge 1 commit into
The-PR-Agent:mainfrom
IsmaelMartinez:fix/asyncio-marker-review-coverage

Conversation

@IsmaelMartinez

Copy link
Copy Markdown
Collaborator

main's build-and-test job is currently red. The three _prepare_prediction tests added in #2589 rely on asyncio_mode = "auto" from pyproject.toml, but the docker test target never copies that file, so pytest runs in strict mode inside the image and rejects them with "async def functions are not natively supported". This adds the explicit @pytest.mark.asyncio marker that every other async test in the suite already carries.

Reproduce with PYTHONPATH=. pytest tests/unittest -o asyncio_mode=strict — 3 failed before, 1667 passed after.

…ocker test image

The three `_prepare_prediction` tests added in The-PR-Agent#2589 rely on `asyncio_mode = "auto"`
from pyproject.toml, but the docker `test` target never copies that file (it adds only
requirements-dev.txt, pr_agent, tests and docker/mosaico). Inside the image pytest
therefore falls back to strict mode and fails all three with "async def functions are
not natively supported", turning main's build-and-test job red for every open PR.

Add the explicit `@pytest.mark.asyncio` marker the rest of the suite already uses.
Verified by running the suite with `-o asyncio_mode=strict`, which reproduces the CI
failure exactly before the change and is fully green after it.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@github-actions github-actions Bot added the bug label Aug 7, 2026
@qodo-free-for-open-source-projects

Copy link
Copy Markdown
Contributor

PR Summary by Qodo

Fix async unit tests by explicitly marking review-coverage tests with pytest-asyncio

🐞 Bug fix 🧪 Tests 🕐 Less than 5 minutes

Grey Divider

AI Description

• Mark three async _prepare_prediction unit tests with @pytest.mark.asyncio.
• Prevent docker test runs (strict asyncio mode) from failing these tests.
• Align the new tests with the suite’s existing async test conventions.
High-Level Assessment

The following are alternative approaches to this PR:

1. Copy `pyproject.toml` into the docker test image
  • ➕ Keeps configuration centralized and avoids per-test markers
  • ➕ Ensures docker runs match local defaults more closely
  • ➖ Expands docker build context and may introduce unrelated settings into the image
  • ➖ Less explicit: test correctness depends on external config presence
2. Set `asyncio_mode=auto` explicitly in the docker test invocation
  • ➕ Minimal code changes (no test edits)
  • ➕ Makes CI intent explicit at the runner level
  • ➖ Diverges from strict-mode safety in docker unless carefully scoped
  • ➖ Can mask missing markers in future async tests

Recommendation: Prefer the PR’s approach: adding @pytest.mark.asyncio is explicit, consistent with the existing suite, and robust to environment/config differences (e.g., docker not copying pyproject.toml). Consider the docker/config alternatives only if you intentionally want configuration-driven async behavior rather than marker-driven tests.

Files changed (1) +3 / -0

Tests (1) +3 / -0
test_pr_reviewer_core.pyAdd pytest-asyncio markers to '_prepare_prediction' async tests +3/-0

Add pytest-asyncio markers to '_prepare_prediction' async tests

• Adds '@pytest.mark.asyncio' to three async unit tests covering '_prepare_prediction'. This ensures the tests run under strict asyncio mode (as in the docker test image) without relying on 'asyncio_mode=auto' from 'pyproject.toml'.

tests/unittest/test_pr_reviewer_core.py

@qodo-free-for-open-source-projects

Copy link
Copy Markdown
Contributor

Code Review by Qodo

🐞 Bugs (0) 📘 Rule violations (0) 📎 Requirement gaps (0)

Grey Divider

Great, no issues found!

Qodo reviewed your code and found no material issues that require review

Grey Divider

  • Author self-review: I have reviewed the code review findings, and addressed the relevant ones.

To customize comments, go to the Qodo configuration screen, or learn more in the docs.

Qodo Logo

@IsmaelMartinez

Copy link
Copy Markdown
Collaborator Author

Superseded. This landed via #2600, which carried the same three markers and merged earlier today, so main is already green. Closing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant