Skip to content

test: Fix unawaited coroutine warnings in Ollama mock tests #11930

Merged
Cristhianzl merged 1 commit intomainfrom
cz/fix-ollama-tests
Feb 27, 2026
Merged

test: Fix unawaited coroutine warnings in Ollama mock tests #11930
Cristhianzl merged 1 commit intomainfrom
cz/fix-ollama-tests

Conversation

@Cristhianzl
Copy link
Member

@Cristhianzl Cristhianzl commented Feb 27, 2026

Eliminate RuntimeWarning "coroutine was never awaited" in Ollama component tests caused by incorrect mock setup.

Changes

  • Replace AsyncMock().raise_for_status.return_value = None with MagicMock(return_value=None) assignment across ChatOllama and OllamaEmbeddings test files
  • Fix 15 occurrences in test_chatollama_component.py and 21 in test_ollama_embeddings_component.py

Summary by CodeRabbit

  • Tests
    • Updated internal test infrastructure for mock configuration in embeddings and language model components. No changes to user-facing functionality or behavior.

@Cristhianzl Cristhianzl merged commit b2d8aa8 into main Feb 27, 2026
11 of 12 checks passed
@Cristhianzl Cristhianzl deleted the cz/fix-ollama-tests branch February 27, 2026 03:24
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 27, 2026

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 6e95b7c and 0904405.

📒 Files selected for processing (2)
  • src/backend/tests/unit/components/embeddings/test_ollama_embeddings_component.py
  • src/backend/tests/unit/components/languagemodels/test_chatollama_component.py

Walkthrough

Two test files update mock configuration for HTTP response handling by replacing raise_for_status.return_value = None with MagicMock(return_value=None). These changes are semantically equivalent and do not alter control flow or error handling behavior.

Changes

Cohort / File(s) Summary
Test Mock Configuration Updates
src/backend/tests/unit/components/embeddings/test_ollama_embeddings_component.py, src/backend/tests/unit/components/languagemodels/test_chatollama_component.py
Updated mock setup for raise_for_status to use explicit MagicMock(return_value=None) instead of direct attribute assignment. Functionally equivalent changes affecting only test mocking configuration.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch cz/fix-ollama-tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions github-actions bot added test Changes to tests and removed test Changes to tests labels Feb 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

test Changes to tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant