Skip to content

Python: improve misc-integration test robustness#5295

Merged
moonbox3 merged 2 commits into
microsoft:mainfrom
moonbox3:improve-int-tests-again
Apr 16, 2026
Merged

Python: improve misc-integration test robustness#5295
moonbox3 merged 2 commits into
microsoft:mainfrom
moonbox3:improve-int-tests-again

Conversation

@moonbox3

Copy link
Copy Markdown
Contributor

Summary

  • Use the local MCP server (already spun up in CI via LOCAL_MCP_URL) for the hosted tools integration test instead of learn.microsoft.com/api/mcp, which persistently rate-limits and blocks the merge queue.
  • Broaden the image description assertion to accept common synonyms (cottage, mansion, villa, etc.) since the model uses varied vocabulary for the same image.

Test plan

  • Unit tests pass locally (113 passed)
  • Verify misc-integration CI job passes with local MCP server

…assertion

The hosted tools integration test was hitting rate limits on the external
learn.microsoft.com MCP server, causing persistent failures that retries
couldn't recover from. Switch to the local MCP server already spun up in
CI via LOCAL_MCP_URL, skipping when the env var isn't set.

Also broaden the image description assertion to accept common synonyms
(cottage, mansion, villa, etc.) instead of just "house", since the model
legitimately uses varied vocabulary for the same image.
Copilot AI review requested due to automatic review settings April 16, 2026 02:17
@moonbox3 moonbox3 added the python Usage: [Issues, PRs], Target: Python label Apr 16, 2026
@moonbox3 moonbox3 self-assigned this Apr 16, 2026

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

Updates Anthropic Python integration tests to be more CI-robust by removing reliance on a rate-limited public MCP endpoint and relaxing an image-description assertion to tolerate model vocabulary variation.

Changes:

  • Switch hosted-tools integration test to use LOCAL_MCP_URL and skip when not provided.
  • Broaden the image-description assertion to accept several synonyms (e.g., cottage/mansion/villa).

Comment thread python/packages/anthropic/tests/test_anthropic_client.py
Comment thread python/packages/anthropic/tests/test_anthropic_client.py Outdated
@moonbox3

moonbox3 commented Apr 16, 2026

Copy link
Copy Markdown
Contributor Author

Python Test Coverage

Python Test Coverage Report •
FileStmtsMissCoverMissing
TOTAL27670320088% 
report-only-changed-files is enabled. No files were changed during this commit :)

Python Unit Test Overview

Tests Skipped Failures Errors Time
5593 20 💤 0 ❌ 0 🔥 1m 28s ⏱️

…oundaries

- Skip hosted tools test when LOCAL_MCP_URL lacks http/https scheme,
  matching the pattern used in test_mcp.py.
- Use regex word boundaries for image assertion to avoid false matches
  like "villain" matching "villa".
@moonbox3 moonbox3 merged commit 611230c into microsoft:main Apr 16, 2026
31 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

python Usage: [Issues, PRs], Target: Python

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants