Skip to content

Commit a2dac02

Browse files
Copilotmsyyc
andauthored
[python] Fix nightly build (#10049)
Tracks [Azure/typespec-azure#3997](Azure/typespec-azure#3997), which deprecated `@operationGroup` in favor of `@client` (with flattened operation hierarchy) and deleted the `multi-service-older-versions` spec. ### Package update - Bumped `@azure-tools/azure-http-specs`: `0.1.0-alpha.38` → `0.1.0-alpha.39-dev.2` ### Deleted tests (spec removed upstream) - `test_azure_resource_manager_multi_service_older_versions.py` + async counterpart - Removed `azure-resource-manager-multi-service-older-versions` from `requirements.txt` ### Updated tests (reflect flat client hierarchy) With `@client` replacing `@operationGroup`, sub-groups are no longer generated — operations are promoted directly onto the parent client: ```python # Before (with @operationGroup) client.group3.two() client.group4.four() client.group5.six() # After (with @client — flat) client.two() client.four() client.six() ``` - **`test_client_structure_clientoperationgroup`** + async: removed `group3`/`group4`/`group5` sub-group access - **`test_client_structure`** + async: updated `renamed_operation` (removed `client.group.*`) and `two_operation_group` (removed `client.group1.*`/`client.group2.*`) - **`test_client_naming`** + async: `Property` and `Header` namespace operations now accessed via `client.property.*` and `client.header.*` sub-groups instead of directly on the root client <!-- START COPILOT ORIGINAL PROMPT --> <details> <summary>Original prompt</summary> > > ---- > > *This section details on the original issue you should resolve* > > <issue_title>[python] add test case for Azure/typespec-azure#3997 > </issue_title> > <issue_description>follow skill https://github.com/microsoft/typespec/blob/main/.github/skills/python-sdk-spector-mock-api-tests/SKILL.md to write test case for Azure/typespec-azure#3997 > </issue_description> > > ## Comments on the Issue (you are @copilot in this section) > > <comments> > </comments> > </details> <!-- START COPILOT CODING AGENT SUFFIX --> - Fixes #10048 <!-- START COPILOT CODING AGENT TIPS --> --- 📱 Kick off Copilot coding agent tasks wherever you are with [GitHub Mobile](https://gh.io/cca-mobile-docs), available on iOS and Android. --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: msyyc <70930885+msyyc@users.noreply.github.com> Co-authored-by: Yuchao Yan <yuchaoyan@microsoft.com>
1 parent ed27486 commit a2dac02

13 files changed

Lines changed: 59 additions & 268 deletions
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
changeKind: internal
3+
packages:
4+
- "@typespec/http-client-python"
5+
---
6+
7+
Update test cases for Azure/typespec-azure#3997: replace `@operationGroup` with `@client` decorator changes. Remove deleted `multi-service-older-versions` tests and update client structure, naming tests to reflect new flat client hierarchy.

packages/http-client-python/.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,6 @@ generator/test/.diff-summary.md
77

88
# Regeneration marker (tracks when generated code was last regenerated)
99
.last-regenerate
10+
11+
# local folder for debug
12+
alpha

packages/http-client-python/generator/test/azure/mock_api_tests/asynctests/test_azure_resource_manager_multi_service_older_versions_async.py

Lines changed: 0 additions & 111 deletions
This file was deleted.

packages/http-client-python/generator/test/azure/mock_api_tests/asynctests/test_client_naming_async.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,17 +16,17 @@ async def client():
1616

1717
@pytest.mark.asyncio
1818
async def test_client(client: NamingClient):
19-
await client.client(models.ClientNameModel(client_name=True))
19+
await client.property.client(models.ClientNameModel(client_name=True))
2020

2121

2222
@pytest.mark.asyncio
2323
async def test_language(client: NamingClient):
24-
await client.language(models.LanguageClientNameModel(python_name=True))
24+
await client.property.language(models.LanguageClientNameModel(python_name=True))
2525

2626

2727
@pytest.mark.asyncio
2828
async def test_compatible_with_encoded_name(client: NamingClient):
29-
await client.compatible_with_encoded_name(models.ClientNameAndJsonEncodedNameModel(client_name=True))
29+
await client.property.compatible_with_encoded_name(models.ClientNameAndJsonEncodedNameModel(client_name=True))
3030

3131

3232
@pytest.mark.asyncio
@@ -41,12 +41,12 @@ async def test_parameter(client: NamingClient):
4141

4242
@pytest.mark.asyncio
4343
async def test_header_request(client: NamingClient):
44-
await client.request(client_name="true")
44+
await client.header.request(client_name="true")
4545

4646

4747
@pytest.mark.asyncio
4848
async def test_header_response(client: NamingClient):
49-
assert (await client.response(cls=lambda x, y, z: z))["default-name"] == "true"
49+
assert (await client.header.response(cls=lambda x, y, z: z))["default-name"] == "true"
5050

5151

5252
@pytest.mark.asyncio

packages/http-client-python/generator/test/azure/mock_api_tests/asynctests/test_client_structure_async.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -45,18 +45,18 @@ async def test_structure_renamed_operation():
4545
await client.renamed_three()
4646
await client.renamed_five()
4747

48-
await client.group.renamed_two()
49-
await client.group.renamed_four()
50-
await client.group.renamed_six()
48+
await client.renamed_two()
49+
await client.renamed_four()
50+
await client.renamed_six()
5151

5252

5353
@pytest.mark.asyncio
5454
async def test_structure_two_operation_group():
55-
client = TwoOperationGroupClient(endpoint="http://localhost:3000", client=ClientType.RENAMED_OPERATION)
56-
await client.group1.one()
57-
await client.group1.three()
58-
await client.group1.four()
59-
60-
await client.group2.two()
61-
await client.group2.five()
62-
await client.group2.six()
55+
client = TwoOperationGroupClient(endpoint="http://localhost:3000", client=ClientType.TWO_OPERATION_GROUP)
56+
await client.one()
57+
await client.three()
58+
await client.four()
59+
60+
await client.two()
61+
await client.five()
62+
await client.six()

packages/http-client-python/generator/test/azure/mock_api_tests/asynctests/test_client_structure_clientoperationgroup_async.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@ async def test_first_client_operations():
1414

1515
await client.one()
1616

17-
await client.group3.two()
18-
await client.group3.three()
17+
await client.two()
18+
await client.three()
1919

20-
await client.group4.four()
20+
await client.four()
2121

2222

2323
@pytest.mark.asyncio
@@ -26,4 +26,4 @@ async def test_second_client_operations():
2626

2727
await client.five()
2828

29-
await client.group5.six()
29+
await client.six()

packages/http-client-python/generator/test/azure/mock_api_tests/test_azure_resource_manager_multi_service_older_versions.py

Lines changed: 0 additions & 107 deletions
This file was deleted.

packages/http-client-python/generator/test/azure/mock_api_tests/test_client_naming.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,15 @@ def client():
1414

1515

1616
def test_client(client: NamingClient):
17-
client.client(models.ClientNameModel(client_name=True))
17+
client.property.client(models.ClientNameModel(client_name=True))
1818

1919

2020
def test_language(client: NamingClient):
21-
client.language(models.LanguageClientNameModel(python_name=True))
21+
client.property.language(models.LanguageClientNameModel(python_name=True))
2222

2323

2424
def test_compatible_with_encoded_name(client: NamingClient):
25-
client.compatible_with_encoded_name(models.ClientNameAndJsonEncodedNameModel(client_name=True))
25+
client.property.compatible_with_encoded_name(models.ClientNameAndJsonEncodedNameModel(client_name=True))
2626

2727

2828
def test_operation(client: NamingClient):
@@ -34,11 +34,11 @@ def test_parameter(client: NamingClient):
3434

3535

3636
def test_header_request(client: NamingClient):
37-
client.request(client_name="true")
37+
client.header.request(client_name="true")
3838

3939

4040
def test_header_response(client: NamingClient):
41-
assert client.response(cls=lambda x, y, z: z)["default-name"] == "true"
41+
assert client.header.response(cls=lambda x, y, z: z)["default-name"] == "true"
4242

4343

4444
def test_model_client(client: NamingClient):

packages/http-client-python/generator/test/azure/mock_api_tests/test_client_structure.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -41,17 +41,17 @@ def test_structure_renamed_operation():
4141
client.renamed_three()
4242
client.renamed_five()
4343

44-
client.group.renamed_two()
45-
client.group.renamed_four()
46-
client.group.renamed_six()
44+
client.renamed_two()
45+
client.renamed_four()
46+
client.renamed_six()
4747

4848

4949
def test_structure_two_operation_group():
5050
client = TwoOperationGroupClient(endpoint="http://localhost:3000", client=ClientType.TWO_OPERATION_GROUP)
51-
client.group1.one()
52-
client.group1.three()
53-
client.group1.four()
51+
client.one()
52+
client.three()
53+
client.four()
5454

55-
client.group2.two()
56-
client.group2.five()
57-
client.group2.six()
55+
client.two()
56+
client.five()
57+
client.six()

0 commit comments

Comments
 (0)