Skip to content

[python] Add body-or-no-content Spector coverage - #12153

Merged
Yuchao Yan (msyyc) merged 6 commits into
mainfrom
copilot/add-test-case-body-or-no-content
Oct 12, 2026
Merged

Yuchao Yan (msyyc) merged 6 commits into
mainfrom
copilot/add-test-case-body-or-no-content

Conversation

Copilot AI commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

Add Python SDK coverage for operations whose successful response is either a model body (HTTP 200) or no content (HTTP 204).

  • Coverage: Shared sync and async tests for Azure and unbranded clients assert BlobLayout(content="hello") for 200 and None for 204.
  • Response metadata: Verify raw status codes and x-ms-request-id headers for both responses.
  • Changelog: Add an internal entry for the Python emitter.

Copilot AI linked an issue Oct 12, 2026 that may be closed by this pull request
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 1 pipeline(s).
1 pipeline(s) were filtered out due to trigger conditions.
There may be pipelines that require an authorized user to comment /azp run to run.

Co-authored-by: msyyc <70930885+msyyc@users.noreply.github.com>
@microsoft-github-policy-service microsoft-github-policy-service Bot added the emitter:client:python Issue for the Python client emitter: @typespec/http-client-python label Oct 12, 2026
Copilot AI changed the title [WIP] Add test case for response body or no content [python] Add body-or-no-content Spector coverage Oct 12, 2026
@msyyc
Yuchao Yan (msyyc) marked this pull request as ready for review October 12, 2026 05:08
Copilot AI balanced review requested due to automatic review settings October 12, 2026 05:08

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.

🟢 Approval recommended

The tests accurately cover both Spector scenarios across Azure and unbranded clients, with a valid changelog entry.

0 open findings

What changed in this PR

Adds Python SDK Spector coverage for successful responses containing either a model body or no content.

Changes:

  • Adds synchronous and asynchronous shared tests for HTTP 200 and 204 responses.
  • Verifies deserialized values, status codes, and response headers.
  • Adds an internal Python emitter changelog entry.
File Description
packages/​http-client-python/​tests/​mock_api/​shared/​test_response_body_or_no_content.py Adds synchronous response tests.
packages/​http-client-python/​tests/​mock_api/​shared/​asynctests/​test_response_body_or_no_content_async.py Adds equivalent asynchronous tests.
.chronus/​changes/​python-response-body-or-no-content-2026-10-12-3-14-0.md Records the internal test coverage update.

🧠 Review effort: Balanced


💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@azure-sdk-automation

Copy link
Copy Markdown

You can try these changes here

🛝 Playground 🌐 Website 🛝 VSCode Extension

@msyyc

Copy link
Copy Markdown
Contributor

For each test case, we could use "cls" to check response header. But for response body, I hope to check it without "cls" so that we could confirm whether generated sdk code work as expected. Copilot

Co-authored-by: msyyc <70930885+msyyc@users.noreply.github.com>

Copilot AI commented Oct 12, 2026

Copy link
Copy Markdown
Contributor Author

For each test case, we could use "cls" to check response header. But for response body, I hope to check it without "cls" so that we could confirm whether generated sdk code work as expected. Copilot

Updated in 9811c2f: all sync and async cases assert BlobLayout or None through calls without cls; separate cls calls retain status/header checks. Runtime tests were blocked by dependency-feed DNS failure and missing test tools; syntax and whitespace checks passed.

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.

🟢 Approval recommended

The tests match the Spector scenarios and follow established shared sync/async testing conventions.

0 open findings

🧠 Review effort: Balanced

Copilot AI balanced review requested due to automatic review settings October 12, 2026 06:01
@pkg-pr-new

pkg-pr-new Bot commented Oct 12, 2026 •

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/@typespec/http-client-python@12153

commit: d2d7169

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.

🟢 Approval recommended

The tests match the Spector scenarios and established shared-test conventions, with an appropriate changelog entry.

0 open findings

🧠 Review effort: Balanced

@github-actions

github-actions Bot commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

All changed packages have been documented.

  • ✅ @typespec/http-client-python
Show changes

@typespec/http-client-python - internal ✏️

Add sync and async Spector tests for responses with a model body or no content, including raw response status and headers.

@msyyc

Copy link
Copy Markdown
Contributor

@github-actions

github-actions Bot commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

Python emitter diff

Baseline gh:2a5cea68b131b42688b6723eb1c9af44efc0e1e6 vs this PR.

No changes to generated output.

Rendered diff: inline on the run summary, or the emitter-diff-html artifact.

Informational check (eng/emitter-diff); does not block the PR.

Co-authored-by: msyyc <70930885+msyyc@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings October 12, 2026 06:16

Copilot AI commented Oct 12, 2026

Copy link
Copy Markdown
Contributor Author

Fix CI failure https://github.com/microsoft/typespec/actions/runs/38210537898/job/114683453074?pr=12153 Copilot

Fixed in 1a261ab: added the generated bodyornocontent module name to CSpell’s dictionary. The exact CI spelling command now passes across all 9,166 files; formatting and lint also pass. Body assertions remain without cls. Full build was blocked locally by a certificate error fetching VS Code license notices.

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.

🟢 Approval recommended

The tests match the Spector scenarios and established shared sync/async testing conventions.

0 open findings

🧠 Review effort: Balanced

Copilot AI balanced review requested due to automatic review settings October 12, 2026 07:11

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.

🟢 Approval recommended

The tests match the Spector scenarios and established shared-test conventions with no unresolved issues.

0 open findings

🧠 Review effort: Balanced

@msyyc
Yuchao Yan (msyyc) added this pull request to the merge queue Oct 12, 2026
Merged via the queue into main with commit 79ca62c Oct 12, 2026
34 of 35 checks passed
@msyyc
Yuchao Yan (msyyc) deleted the copilot/add-test-case-body-or-no-content branch October 12, 2026 08:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

emitter:client:python Issue for the Python client emitter: @typespec/http-client-python

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[python] add test case

4 participants