8000 test: fix async test failures in cache embeddings and buffer strategy tests by Pouyanpi · Pull Request #1237 · NVIDIA/NeMo-Guardrails · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

test: fix async test failures in cache embeddings and buffer strategy tests #1237

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from

Conversation

Pouyanpi
Copy link
Collaborator

@Pouyanpi Pouyanpi changed the title Fix/async tests test: fix async tests Jun 24, 2025
@Pouyanpi Pouyanpi marked this pull request as ready for review June 24, 2025 13:38
@Pouyanpi Pouyanpi changed the title test: fix async tests test: fix async test failures in cache embeddings and buffer strategy tests Jun 24, 2025
@Pouyanpi Pouyanpi added this to the v0.14.1 milestone Jun 24, 2025
@codecov-commenter
Copy link

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 68.65%. Comparing base (5f9974a) to head (b0917d9).

Additional details and impacted files
@@           Coverage Diff            @@
##           develop    #1237   +/-   ##
========================================
  Coverage    68.65%   68.65%           
========================================
  Files          161      161           
  Lines        15978    15978           
========================================
  Hits         10969    10969           
  Misses        5009     5009           
Flag Coverage Δ
python 68.65% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@Pouyanpi Pouyanpi requested review from cparisien and Copilot June 25, 2025 10:24
Copy link
@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR fixes async test failures in cache embeddings and buffer strategy tests by updating method signatures, patching strategies, and call count assertions.

  • Converted get_embeddings to an async function and updated corresponding tests.
  • Updated patching to use mocks for proper async behavior and adjusted assertions on call counts.
  • Changed an async test to a synchronous one for the buffer chunk strategy.

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
tests/test_cache_embeddings.py Converted get_embeddings to async, added pytest.mark.asyncio decorator, and updated caching-related patching and assertions.
tests/test_buffer_strategy.py Changed the test_generate_chunk_str function from async to sync and set up the buffer_strategy.last_index appropriately.

]
mock_cache.get.assert_not_called()
mock_cache.set.assert_not_called()
with patch.object(MyClass, "cache_config", new_callable=lambda: mock_config):
Copy link
Preview
Copilot AI Jun 25, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] Since cache_config is a property, consider using PropertyMock (e.g., new_callable=PropertyMock) for clarity and to ensure consistent behavior when patching properties.

Copilot uses AI. Check for mistakes.

@@ -68,10 +68,13 @@ async def async_enumerate(aiterable, start=0):
idx += 1


async def test_generate_chunk_str():
def test_generate_chunk_str():
Copy link
Preview
Copilot AI Jun 25, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] Ensure that changing the test from async to synchronous is intentional, and if so, consider updating the test name or documentation to reflect the synchronous behavior.

Suggested change
def test_generate_chunk_str():
def test_generate_chunk_str_synchronous():

Copilot uses AI. Check for mistakes.

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.

2 participants
0