Skip to content

Fix mock_provider_lazy configuration in integration tests#232

Merged
bashandbone merged 2 commits intomainfrom
fix-mock-provider-lazy-integration-tests-16248330206876263418
Mar 16, 2026
Merged

Fix mock_provider_lazy configuration in integration tests#232
bashandbone merged 2 commits intomainfrom
fix-mock-provider-lazy-integration-tests-16248330206876263418

Conversation

@bashandbone
Copy link
Contributor

@bashandbone bashandbone commented Mar 16, 2026

This submission fixes an issue in the integration tests for the client factory where the mock_provider_lazy object (representing a late-imported provider class) was not correctly configured with a __name__ and a return_value.

Specifically:

  • In test_qdrant_provider_with_memory_mode, added mock_provider_lazy.__name__ = "MockQdrantProvider".
  • In test_qdrant_provider_with_url_mode, added mock_provider_lazy.__name__ = "MockQdrantProvider" and mock_provider_lazy.return_value = Mock().

These changes align the Qdrant mock configuration with the Voyage mock configuration in the same file and ensure that the factory can successfully call the mock as if it were a class or factory function.


PR created automatically by Jules for task 16248330206876263418 started by @bashandbone

Summary by Sourcery

Fix Qdrant provider integration tests by correctly configuring the lazy mock provider used by the client factory.

Bug Fixes:

  • Set a name on the Qdrant lazy mock provider so it behaves like a real provider class in integration tests.
  • Ensure the Qdrant lazy mock provider has a return_value so it can be called like a factory in integration tests.

Tests:

  • Adjust Qdrant client factory integration tests to align lazy provider mocking with the existing Voyage provider setup.

…tion tests

Added missing `__name__` and `return_value` assignments to `mock_provider_lazy` in Qdrant provider integration tests. This ensures the mocks are consistent with how they are used by the provider factory and matches the pattern used for other providers in the same test file.

Co-authored-by: bashandbone <89049923+bashandbone@users.noreply.github.com>
@google-labs-jules
Copy link
Contributor

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

Copilot AI review requested due to automatic review settings March 16, 2026 15:19
@sourcery-ai
Copy link
Contributor

sourcery-ai bot commented Mar 16, 2026

Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Adjusts Qdrant provider integration tests to correctly configure the lazy mock provider so it behaves like a late-imported provider class, matching the existing Voyage provider test setup.

File-Level Changes

Change Details Files
Configure the lazy Qdrant provider mock to correctly mimic a named, callable provider class in both memory and URL mode integration tests.
  • In the memory-mode Qdrant test, set the lazy provider mock’s name to a realistic class name to satisfy factory expectations.
  • In the memory-mode Qdrant test, ensure the lazy provider mock still resolves to a provider class mock and has an explicit return_value when called.
  • In the URL-mode Qdrant test, set the lazy provider mock’s name to a realistic class name to align with other provider mocks.
  • In the URL-mode Qdrant test, assign a return_value to the lazy provider mock so the factory can call it as a class or factory function.
tests/integration/chunker/config/test_client_factory_integration.py

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey - I've left some high level feedback:

  • The setup for mock_provider_lazy is duplicated between the two Qdrant tests; consider extracting a small helper (e.g., make_qdrant_lazy_mock()) to configure __name__, _resolve, and return_value in one place for consistency and easier future changes.
  • The inline comment referencing a specific line number (line 959) in test_qdrant_provider_with_url_mode is brittle; instead, describe the behavioral reason (e.g., "mock_provider_lazy is invoked like the provider class") so the comment stays accurate if code is refactored.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- The setup for `mock_provider_lazy` is duplicated between the two Qdrant tests; consider extracting a small helper (e.g., `make_qdrant_lazy_mock()`) to configure `__name__`, `_resolve`, and `return_value` in one place for consistency and easier future changes.
- The inline comment referencing a specific line number (`line 959`) in `test_qdrant_provider_with_url_mode` is brittle; instead, describe the behavioral reason (e.g., "mock_provider_lazy is invoked like the provider class") so the comment stays accurate if code is refactored.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Copy link
Contributor

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

Fixes the lazy provider mock setup in the (deprecated/skipped) client-factory integration tests so the mocked “late-imported provider class” behaves like a real callable class/factory.

Changes:

  • Set mock_provider_lazy.__name__ for Qdrant mocks (memory + URL modes) to match the pattern used by the Voyage mock.
  • Ensure the Qdrant URL-mode lazy mock has an explicit return_value so calls succeed when the factory treats it as callable.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@bashandbone
Copy link
Contributor Author

@jules please implement the suggestions below:

The setup for mock_provider_lazy is duplicated between the two Qdrant tests; consider extracting a small helper (e.g., make_qdrant_lazy_mock()) to configure name, _resolve, and return_value in one place for consistency and easier future changes.
The inline comment referencing a specific line number (line 959) in test_qdrant_provider_with_url_mode is brittle; instead, describe the behavioral reason (e.g., "mock_provider_lazy is invoked like the provider class") so the comment stays accurate if code is refactored.

@google-labs-jules
Copy link
Contributor

@jules please implement the suggestions below:

The setup for mock_provider_lazy is duplicated between the two Qdrant tests; consider extracting a small helper (e.g., make_qdrant_lazy_mock()) to configure name, _resolve, and return_value in one place for consistency and easier future changes.
The inline comment referencing a specific line number (line 959) in test_qdrant_provider_with_url_mode is brittle; instead, describe the behavioral reason (e.g., "mock_provider_lazy is invoked like the provider class") so the comment stays accurate if code is refactored.

I have implemented the suggestions. I created a make_lazy_provider_mock() helper function to centralize the configuration of __name__, _resolve, and return_value. I also replaced the brittle line-number references with behavioral descriptions, such as explaining that the mock is invoked like a provider class.

- Implemented `make_lazy_provider_mock` helper to centralize mock configuration.
- Replaced brittle line-number comments with behavioral descriptions.
- Updated all Voyage and Qdrant provider tests to use the new helper.

Co-authored-by: bashandbone <89049923+bashandbone@users.noreply.github.com>
@bashandbone bashandbone merged commit 8694807 into main Mar 16, 2026
14 of 19 checks passed
@bashandbone bashandbone deleted the fix-mock-provider-lazy-integration-tests-16248330206876263418 branch March 16, 2026 15:38
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