Skip to content

Add test coverage for optional BigQuery dependency #1027

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 1 commit into
base: main
Choose a base branch
from

Conversation

pankaj-bind
Copy link

PR Description

This update addresses the issue of limited test coverage for optional dependencies within the langchain-google-community package, using BigQueryLoader as the initial implementation.

Previously, modules with optional dependencies might not have been adequately tested for scenarios where those dependencies were missing, potentially leading to unexpected errors for users with minimal installations.

This change enhances the robustness of the package by:

  1. Adding a Guarded Import: The BigQueryLoader now checks for the google-cloud-bigquery package upon instantiation. If the dependency is not found, it raises a clear ImportError with instructions on how to install it.
  2. Introducing a New Unit Test: A dedicated unit test has been added to simulate an environment where google-cloud-bigquery is not installed. This test verifies that the BigQueryLoader raises the correct ImportError, ensuring this behavior is maintained and preventing future regressions.

This approach improves the reliability and user experience of the library, providing graceful failures and clear guidance when required dependencies are missing.

All existing and new tests pass successfully after these changes.

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.

1 participant