Skip to content

test: use Client in test_client_server_integration.py#807

Merged
ishymko merged 3 commits into1.0-devfrom
ishymko/test-client-server-intergation
Mar 11, 2026
Merged

test: use Client in test_client_server_integration.py#807
ishymko merged 3 commits into1.0-devfrom
ishymko/test-client-server-intergation

Conversation

@ishymko
Copy link
Copy Markdown
Member

@ishymko ishymko commented Mar 11, 2026

To make tests a bit higher level and closer to how it's used externally.

@ishymko ishymko requested a review from a team as a code owner March 11, 2026 10:33
@ishymko ishymko force-pushed the ishymko/test-client-server-intergation branch from 18eccd8 to 83a66f9 Compare March 11, 2026 10:33
@ishymko ishymko changed the title test: use ClientFactory in test_client_server_integration.py test: use Client in test_client_server_integration.py Mar 11, 2026
@ishymko ishymko force-pushed the ishymko/test-client-server-intergation branch from 83a66f9 to 1bfded2 Compare March 11, 2026 10:40
@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly refactors the integration test suite to leverage the Client abstraction, moving away from direct Transport object manipulation. This change aims to elevate the testing level, making tests more representative of how the client library is intended to be used by external consumers. By interacting with the public Client interface, the tests become clearer, more maintainable, and provide a higher-fidelity validation of the system's behavior.

Highlights

  • Refactored Integration Tests: The integration tests were updated to use the higher-level Client class instead of directly interacting with Transport objects, making tests more aligned with external usage.
  • Updated Test Setups: The jsonrpc_setup, rest_setup, and grpc_setup fixtures were modified to instantiate Client objects via ClientFactory, streamlining client creation.
  • Renamed Test Functions: Numerous test functions were renamed from test_transport_* to test_client_* to accurately reflect that they are now testing the Client interface.
  • Enhanced gRPC Setup: The gRPC setup now dynamically updates the agent card's gRPC interface URL, improving flexibility in test environments.
Changelog
  • tests/integration/test_client_server_integration.py
    • Updated imports to include Client and ClientFactory and removed direct Transport related imports.
    • Modified the agent_card fixture to include a JSON-RPC interface for broader test coverage.
    • Refactored the TransportSetup NamedTuple to encapsulate a Client instance instead of a ClientTransport.
    • Updated jsonrpc_setup, rest_setup, and grpc_setup fixtures to construct Client instances using ClientFactory.
    • Renamed all test_transport_* functions to test_client_* to reflect the new client-centric testing approach.
    • Adjusted test logic, method calls, and resource closing to align with the Client object's interface.
    • Removed the test_transport_get_card test, as its functionality is now implicitly covered by the Client.
    • Modified malformed payload tests to access the underlying transport through the Client object for consistency.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request refactors the client-server integration tests to use the higher-level Client interface instead of directly interacting with transports. This is a great improvement as it makes the tests more representative of the SDK's public API. The changes are well-implemented and consistent across the test suite. I have one minor suggestion to improve code clarity in the tests.

I am having trouble creating individual review comments. Click here to see my feedback.

tests/integration/test_client_server_integration.py (594-595)

low

The client object, being an instance of BaseClient, is guaranteed to have a close method as it's defined in the Client ABC. Therefore, the hasattr check is redundant and can be removed for cleaner code.

This also applies to similar checks in:

  • test_client_get_signed_extended_card (line 725)
  • test_client_get_signed_base_and_extended_cards (line 808)
    await client.close()

@ishymko ishymko force-pushed the ishymko/test-client-server-intergation branch from 9f31edc to f6be674 Compare March 11, 2026 11:33
@ishymko ishymko merged commit f344d2d into 1.0-dev Mar 11, 2026
9 checks passed
@ishymko ishymko deleted the ishymko/test-client-server-intergation branch March 11, 2026 11:36
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