Skip to content

test(python): add response replacement mock API coverage - #12010

Closed
Yuchao Yan (msyyc) with Copilot wants to merge 7 commits into
mainfrom
copilot/add-test-case-for-5471
Closed

Yuchao Yan (msyyc) with Copilot wants to merge 7 commits into
mainfrom
copilot/add-test-case-for-5471

Conversation

Copilot AI commented Sep 18, 2026 •

Copy link
Copy Markdown
Contributor

Adds Python mock API coverage for Azure Spector response-replacement scenarios introduced in Azure/typespec-azure#5471.

Changes

  • Spector dependency

    • Updates @azure-tools/azure-http-specs to 0.1.0-alpha.46-dev.2.
  • Mock API coverage

    • Adds synchronous and asynchronous tests for void_response and bytes_response.
    • Verifies both operations deserialize the wire response:
assert client.void_response() == Widget(name="widget")
assert client.bytes_response() == Widget(name="widget")
  • Changelog
    • Adds an internal @typespec/http-client-python change entry.

@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 Sep 18, 2026
Copilot AI changed the title [WIP] Add test case for Azure typespec pull request 5471 test(python): add response replacement mock API coverage Sep 18, 2026
@msyyc

Copy link
Copy Markdown
Contributor

Copilot resolve the merge conflicts in this pull request

1 similar comment
@msyyc

Copy link
Copy Markdown
Contributor

Copilot resolve the merge conflicts in this pull request

…-for-5471

# Conflicts:
#	packages/http-client-python/package.json

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

Copilot AI commented Sep 24, 2026

Copy link
Copy Markdown
Contributor Author

Copilot resolve the merge conflicts in this pull request

Resolved the merge conflict and pushed merge commit 2dce6e2c.

Copilot AI commented Sep 24, 2026

Copy link
Copy Markdown
Contributor Author

Copilot resolve the merge conflicts in this pull request

The branch already contains the current main merge (2dce6e2c); no conflicts remain to resolve.

Co-authored-by: msyyc <70930885+msyyc@users.noreply.github.com>
@msyyc
Yuchao Yan (msyyc) marked this pull request as ready for review September 30, 2026 03:24
Copilot AI balanced review requested due to automatic review settings September 30, 2026 03:24
@pkg-pr-new

pkg-pr-new Bot commented Sep 30, 2026 •

Copy link
Copy Markdown

Open in StackBlitz

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

commit: 3fec33c

@github-actions

Copy link
Copy Markdown
Contributor

All changed packages have been documented.

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

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

Add mock API tests for client response replacement.

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.

Copilot review overview

🟡 Changes recommended

The tests assert fallback model deserialization instead of the response-replacement behavior defined by the linked Spector scenario.

Review effort: Balanced
Findings: 2 Medium severity

Open (2)
What changed in this PR

Adds Python mock API coverage for Azure response-replacement scenarios.

Changes:

  • Updates Azure HTTP specs and regeneration configuration.
  • Adds synchronous and asynchronous tests.
  • Adds an internal changelog entry.
File Description
test_azure_client_generator_core_response_replacement.py Adds sync response tests.
asynctests/​test_azure_client_generator_core_response_replacement_async.py Adds async response tests.
package.json Updates the Spector dependency.
package-lock.json Locks the updated dependency.
regenerate-common.ts Registers generation options for the scenario.
.chronus/​changes/​python-response-replacement-mock-api-tests-2026-9-18-2-0-7.md Records the internal change.
Files not reviewed (1)
  • packages/http-client-python/package-lock.json: Generated file

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

Comment on lines +18 to +22
@pytest.mark.asyncio
async def test_void_response(client: ResponseReplacementClient):
assert await client.void_response() == Widget(name="widget")


Comment on lines +17 to +21
def test_void_response(client: ResponseReplacementClient):
assert client.void_response() == Widget(name="widget")


def test_bytes_response(client: ResponseReplacementClient):
@github-actions

Copy link
Copy Markdown
Contributor

Python emitter diff

Baseline gh:1b3f984e3914b624f7d9af41a3c837a288d39648 vs this PR.

⚠️ emitter-diff failed (exit 1) — tool/build error, not a diff. See the run.

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

@msyyc
Yuchao Yan (msyyc) marked this pull request as draft September 30, 2026 03:36
auto-merge was automatically disabled September 30, 2026 03:36

Pull request was converted to draft

@msyyc

Copy link
Copy Markdown
Contributor

Copilot resolve the merge conflicts in this pull request

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

Copilot AI commented Oct 8, 2026

Copy link
Copy Markdown
Contributor Author

Copilot resolve the merge conflicts in this pull request

Resolved the conflicts and merged latest main in 449fce94ad. Preserved the Python tests and adopted main’s stable Spector dependencies. Dependency consistency and secret checks passed; build/test/lint/format validation was blocked by missing installed dependencies.

@msyyc
Yuchao Yan (msyyc) marked this pull request as ready for review October 9, 2026 02:45
Copilot AI balanced review requested due to automatic review settings October 9, 2026 02:45

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.

🔵 Needs a closer look

The assertions validate normal model deserialization instead of the linked void and raw-bytes replacement contracts.

2 open findings

🧠 Review effort: Balanced

@msyyc
Yuchao Yan (msyyc) deleted the copilot/add-test-case-for-5471 branch October 9, 2026 02:55
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 for https://github.com/Azure/typespec-azure/pull/5471

3 participants