Skip to content

enhancing python SDK test coverage#47360

Merged
simorenoh merged 20 commits into
mainfrom
users/dibahl/enhancing-test-coverage
Jun 19, 2026
Merged

enhancing python SDK test coverage#47360
simorenoh merged 20 commits into
mainfrom
users/dibahl/enhancing-test-coverage

Conversation

@dibahlfi

@dibahlfi dibahlfi commented Jun 4, 2026

Copy link
Copy Markdown
Member

enhancing python SDK test coverage

@dibahlfi dibahlfi requested a review from a team as a code owner June 4, 2026 22:20
Copilot AI review requested due to automatic review settings June 4, 2026 22:20
@dibahlfi

dibahlfi commented Jun 4, 2026

Copy link
Copy Markdown
Member Author

@sdkReviewAgent-2

@github-actions github-actions Bot added the Cosmos label Jun 4, 2026
@dibahlfi

dibahlfi commented Jun 4, 2026

Copy link
Copy Markdown
Member Author

/azp run python - cosmos - tests

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 substantially expands azure-cosmos SDK coverage across sync + async surfaces, focusing on regressions and behavioral contracts around request headers (User-Agent, SessionToken, Content-Length, response headers), query/feed-range behavior, and routing-map provider resiliency. It also includes some docstring/comment cleanups.

Changes:

  • Adds new regression/integration tests for user_agent_overwrite, read_timeout propagation, session-token scoping for feed-range/partition-key queries, and UTF-8 decode fallback behavior (including paged iteration).
  • Extends routing-map provider unit + integration coverage (including 503 + sub-status assertions and concurrency scenarios).
  • Adds additional query/feed-range and encoding (emoji) round-trip tests, plus async parity tests for aggregate utilities and response-header contracts.

Reviewed changes

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

Show a summary per file
File Description
sdk/cosmos/azure-cosmos/tests/test_user_agent_overwrite_regression.py New sync regression tests for user_agent_overwrite combinations and wire User-Agent prefix capture.
sdk/cosmos/azure-cosmos/tests/test_user_agent_overwrite_regression_async.py Async counterpart of the user_agent_overwrite regression suite.
sdk/cosmos/azure-cosmos/tests/test_session.py Adds stronger feed-range session-token scoping tests (value/pagination/partition_key-only).
sdk/cosmos/azure-cosmos/tests/test_session_async.py Async versions of the stronger feed-range session-token scoping tests.
sdk/cosmos/azure-cosmos/tests/test_session_token_unit.py Adds direct unit coverage for set_session_token_header sync/async behavior for single-partition selection.
sdk/cosmos/azure-cosmos/tests/test_routing_map_provider_unit.py Enhances unit coverage and asserts 503 sub-status for routing-map snapshot inconsistency; adds SmartRoutingMapProvider e2e tests.
sdk/cosmos/azure-cosmos/tests/test_routing_map_provider_unit_async.py Async equivalent of routing-map provider unit enhancements and e2e tests.
sdk/cosmos/azure-cosmos/tests/routing/test_routing_map_provider.py Adds SmartRoutingMapProvider end-to-end 503 conversion coverage in the routing integration suite.
sdk/cosmos/azure-cosmos/tests/routing/test_routing_map_provider_async.py Refactors imports and adds SmartRoutingMapProvider async end-to-end tests; includes text updates in docstrings/comments.
sdk/cosmos/azure-cosmos/tests/test_response_decoding.py Tightens/extends tests around env-var parsing and decode behavior; documentation updates.
sdk/cosmos/azure-cosmos/tests/test_response_decoding_paged.py New tests for strict vs REPLACE/IGNORE decoding behavior across multiple sequential pages (sync + async request paths).
sdk/cosmos/azure-cosmos/tests/test_request_response_decoding.py Simplifies docs and keeps wiring/behavior tests ensuring _Request uses shared decode helper and surfaces typed exceptions.
sdk/cosmos/azure-cosmos/tests/test_read_timeout_propagation.py New sync tests to verify read_timeout propagation to transport kwargs across query entry points and precedence rules.
sdk/cosmos/azure-cosmos/tests/test_read_timeout_propagation_async.py Async parity for read-timeout propagation assertions.
sdk/cosmos/azure-cosmos/tests/test_query_response_headers_async.py Adds additional async response-header contract tests and a long-pagination bounded-memory test.
sdk/cosmos/azure-cosmos/tests/test_query_feed_range.py Adds multi-partition SELECT VALUE shape/merge assertions for non-aggregate vs aggregate projections.
sdk/cosmos/azure-cosmos/tests/test_query_feed_range_async.py Async parity for the multi-partition SELECT VALUE shape/merge assertions.
sdk/cosmos/azure-cosmos/tests/test_query_feed_range_multipartition_async.py Adjusts async client creation to exercise AAD lane; adds pagination resume tests and safety-guard tests for stalled/overlap cases.
sdk/cosmos/azure-cosmos/tests/test_query_aggregate_utils_unit_async.py New async-side unit tests ensuring shared aggregate classifier/merge behavior parity.
sdk/cosmos/azure-cosmos/tests/test_partition_split_retry_unit.py Expands/cleans up unit tests around structured continuation tokens and removes noisy debug printing.
sdk/cosmos/azure-cosmos/tests/test_partition_split_retry_unit_async.py Async parity for the continuation-token explode/resume and routing-lookup failure checkpoint behavior.
sdk/cosmos/azure-cosmos/tests/test_feed_range_continuation_token.py Extends aggregate detection/merge tests (MIN/MAX case insensitivity, mixed numeric types, boolean classification guards).
sdk/cosmos/azure-cosmos/tests/test_encoding.py Adds sync emoji/multibyte round-trip tests (point + query).
sdk/cosmos/azure-cosmos/tests/test_encoding_async.py New async emoji/multibyte round-trip tests (point + query).
sdk/cosmos/azure-cosmos/tests/test_cosmos_paged_unit.py New unit tests for sync paged wrappers (CosmosItemPaged, CosmosDict, CosmosList) response-header API semantics.
sdk/cosmos/azure-cosmos/tests/test_cosmos_paged_unit_async.py New unit tests for async paged wrapper (CosmosAsyncItemPaged) and response-header API guards.
sdk/cosmos/azure-cosmos/tests/test_content_length_encoding.py Simplifies docs and adds bytes/bytearray body behavior pinning in Content-Length tests (sync + async).
sdk/cosmos/azure-cosmos/tests/test_availability_strategy.py Adds test ensuring per-request availability_strategy=None falls back to client-level hedging strategy (sync).
sdk/cosmos/azure-cosmos/tests/test_availability_strategy_async.py Async parity for availability_strategy=None fallback behavior.
sdk/cosmos/azure-cosmos/tests/test_aio_extras_packaging_unit.py New packaging metadata test ensuring aio extras are declared and async module imports.
sdk/cosmos/azure-cosmos/azure/cosmos/_location_cache.py Docstring/comment tightening for location list cleaning and region-name normalization logic.

Comment thread sdk/cosmos/azure-cosmos/tests/test_session.py Outdated
Comment thread sdk/cosmos/azure-cosmos/tests/test_session.py Outdated
Comment thread sdk/cosmos/azure-cosmos/tests/test_session_async.py Outdated
Comment thread sdk/cosmos/azure-cosmos/tests/test_session_token_unit.py Outdated
Comment thread sdk/cosmos/azure-cosmos/tests/test_aio_extras_packaging_unit.py Outdated
Comment thread sdk/cosmos/azure-cosmos/tests/routing/test_routing_map_provider_async.py Outdated
Comment thread sdk/cosmos/azure-cosmos/tests/routing/test_routing_map_provider_async.py Outdated
Comment thread sdk/cosmos/azure-cosmos/tests/routing/test_routing_map_provider_async.py Outdated
Comment thread sdk/cosmos/azure-cosmos/tests/test_user_agent_overwrite_regression_async.py Outdated
Comment thread sdk/cosmos/azure-cosmos/tests/test_session_token_unit.py
Comment thread sdk/cosmos/azure-cosmos/tests/test_availability_strategy.py
Comment thread sdk/cosmos/azure-cosmos/tests/test_query_feed_range.py
Comment thread sdk/cosmos/azure-cosmos/tests/test_location_cache_async.py Outdated
Comment thread sdk/cosmos/azure-cosmos/tests/test_semantic_reranker_unit.py
@xinlian12

Copy link
Copy Markdown
Member

Review complete (56:08)

Posted 6 inline comment(s).

Steps: ✓ context, correctness, cross-sdk, design, history, past-prs, synthesis, test-coverage

@dibahlfi

dibahlfi commented Jun 5, 2026

Copy link
Copy Markdown
Member Author

@sdkReviewAgent-2

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).

Comment thread sdk/cosmos/azure-cosmos/tests/test_cosmos_paged_unit_async.py
Comment thread sdk/cosmos/azure-cosmos/tests/test_semantic_reranker_unit.py
Comment thread sdk/cosmos/azure-cosmos/tests/test_request_response_decoding.py
Comment thread sdk/cosmos/azure-cosmos/tests/test_query.py Outdated
Comment thread sdk/cosmos/azure-cosmos/tests/test_query_async.py
Comment thread sdk/cosmos/azure-cosmos/tests/test_query_aggregate_utils_unit_async.py Outdated
Comment thread sdk/cosmos/azure-cosmos/tests/test_query.py Outdated
Comment thread sdk/cosmos/azure-cosmos/tests/test_query_async.py Outdated
Comment thread sdk/cosmos/azure-cosmos/tests/test_aio_extras_packaging_unit.py Outdated
Comment thread sdk/cosmos/azure-cosmos/tests/test_query_response_headers.py Outdated
@xinlian12

Copy link
Copy Markdown
Member

Review complete (57:48)

Posted 10 inline comment(s).

Steps: ✓ context, correctness, cross-sdk, design, history, past-prs, synthesis, test-coverage

Comment thread sdk/cosmos/azure-cosmos/azure/cosmos/_location_cache.py
Comment thread sdk/cosmos/azure-cosmos/tests/test_response_decoding_paged.py Outdated
@xinlian12

Copy link
Copy Markdown
Member

Review complete (04:50)

Posted 2 inline comment(s).

Steps: ✓ context, correctness, cross-sdk, design, history, past-prs, synthesis, test-coverage

@dibahlfi

Copy link
Copy Markdown
Member Author

/azp run python - cosmos - tests

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).

@tvaron3 tvaron3 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM, thanks Dikshi

@kushagraThapar kushagraThapar left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM, thanks @dibahlfi

@simorenoh simorenoh enabled auto-merge (squash) June 18, 2026 20:19
@simorenoh simorenoh merged commit 53cd698 into main Jun 19, 2026
36 checks passed
@simorenoh simorenoh deleted the users/dibahl/enhancing-test-coverage branch June 19, 2026 15:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

6 participants