Skip to content

Commit be0ee80

Browse files
authored
[Python] optimize perf for test generation and sample generation (#3325)
1 parent 5b2c772 commit be0ee80

10 files changed

Lines changed: 40 additions & 97 deletions
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
changeKind: internal
3+
packages:
4+
- "@autorest/python"
5+
- "@azure-tools/typespec-python"
6+
---
7+
8+
Optimize sdk generation performance

packages/autorest.python/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
},
3030
"homepage": "https://github.com/Azure/autorest.python/blob/main/README.md",
3131
"dependencies": {
32-
"@typespec/http-client-python": "~0.26.2",
32+
"@typespec/http-client-python": "https://artprodcus3.artifacts.visualstudio.com/A0fb41ef4-5012-48a9-bf39-4ee3de03ee35/29ec6040-b234-4e31-b139-33dc4287b756/_apis/artifact/cGlwZWxpbmVhcnRpZmFjdDovL2F6dXJlLXNkay9wcm9qZWN0SWQvMjllYzYwNDAtYjIzNC00ZTMxLWIxMzktMzNkYzQyODdiNzU2L2J1aWxkSWQvNTgyNTIxNC9hcnRpZmFjdE5hbWUvYnVpbGRfYXJ0aWZhY3RzX3B5dGhvbg2/content?format=file&subPath=%2Fpackages%2Ftypespec-http-client-python-0.26.2.tgz",
3333
"@autorest/system-requirements": "~1.0.2",
3434
"fs-extra": "~11.2.0",
3535
"tsx": "~4.19.1"
@@ -47,4 +47,4 @@
4747
"requirements.txt",
4848
"generator/"
4949
]
50-
}
50+
}

packages/typespec-python/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@
6767
"js-yaml": "~4.1.0",
6868
"semver": "~7.6.2",
6969
"tsx": "~4.19.1",
70-
"@typespec/http-client-python": "~0.26.2",
70+
"@typespec/http-client-python": "https://artprodcus3.artifacts.visualstudio.com/A0fb41ef4-5012-48a9-bf39-4ee3de03ee35/29ec6040-b234-4e31-b139-33dc4287b756/_apis/artifact/cGlwZWxpbmVhcnRpZmFjdDovL2F6dXJlLXNkay9wcm9qZWN0SWQvMjllYzYwNDAtYjIzNC00ZTMxLWIxMzktMzNkYzQyODdiNzU2L2J1aWxkSWQvNTgyNTIxNC9hcnRpZmFjdE5hbWUvYnVpbGRfYXJ0aWZhY3RzX3B5dGhvbg2/content?format=file&subPath=%2Fpackages%2Ftypespec-http-client-python-0.26.2.tgz",
7171
"fs-extra": "~11.2.0"
7272
},
7373
"devDependencies": {
@@ -103,4 +103,4 @@
103103
"chalk": "5.3.0",
104104
"@types/fs-extra": "11.0.4"
105105
}
106-
}
106+
}

packages/typespec-python/test/azure/generated/azure-client-generator-core-hierarchy-building/generated_tests/test_hierarchy_building_animal_operations_operations.py

Lines changed: 4 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,9 @@ class TestHierarchyBuildingAnimalOperationsOperations(HierarchyBuildingClientTes
1717
def test_animal_operations_update_pet_as_animal(self, hierarchybuilding_endpoint):
1818
client = self.create_client(endpoint=hierarchybuilding_endpoint)
1919
response = client.animal_operations.update_pet_as_animal(
20-
animal={
21-
"breed": "str",
22-
"kind": "dog",
23-
"name": "str",
24-
"trained": bool
25-
}
26-
,
20+
animal={"breed": "str", "kind": "dog", "name": "str", "trained": bool},
2721
)
28-
22+
2923
# please add some check logic here by yourself
3024
# ...
3125

@@ -34,15 +28,8 @@ def test_animal_operations_update_pet_as_animal(self, hierarchybuilding_endpoint
3428
def test_animal_operations_update_dog_as_animal(self, hierarchybuilding_endpoint):
3529
client = self.create_client(endpoint=hierarchybuilding_endpoint)
3630
response = client.animal_operations.update_dog_as_animal(
37-
animal={
38-
"breed": "str",
39-
"kind": "dog",
40-
"name": "str",
41-
"trained": bool
42-
}
43-
,
31+
animal={"breed": "str", "kind": "dog", "name": "str", "trained": bool},
4432
)
45-
33+
4634
# please add some check logic here by yourself
4735
# ...
48-

packages/typespec-python/test/azure/generated/azure-client-generator-core-hierarchy-building/generated_tests/test_hierarchy_building_animal_operations_operations_async.py

Lines changed: 4 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,9 @@ class TestHierarchyBuildingAnimalOperationsOperationsAsync(HierarchyBuildingClie
1818
async def test_animal_operations_update_pet_as_animal(self, hierarchybuilding_endpoint):
1919
client = self.create_async_client(endpoint=hierarchybuilding_endpoint)
2020
response = await client.animal_operations.update_pet_as_animal(
21-
animal={
22-
"breed": "str",
23-
"kind": "dog",
24-
"name": "str",
25-
"trained": bool
26-
}
27-
,
21+
animal={"breed": "str", "kind": "dog", "name": "str", "trained": bool},
2822
)
29-
23+
3024
# please add some check logic here by yourself
3125
# ...
3226

@@ -35,15 +29,8 @@ async def test_animal_operations_update_pet_as_animal(self, hierarchybuilding_en
3529
async def test_animal_operations_update_dog_as_animal(self, hierarchybuilding_endpoint):
3630
client = self.create_async_client(endpoint=hierarchybuilding_endpoint)
3731
response = await client.animal_operations.update_dog_as_animal(
38-
animal={
39-
"breed": "str",
40-
"kind": "dog",
41-
"name": "str",
42-
"trained": bool
43-
}
44-
,
32+
animal={"breed": "str", "kind": "dog", "name": "str", "trained": bool},
4533
)
46-
34+
4735
# please add some check logic here by yourself
4836
# ...
49-

packages/typespec-python/test/azure/generated/azure-client-generator-core-hierarchy-building/generated_tests/test_hierarchy_building_dog_operations_operations.py

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,8 @@ class TestHierarchyBuildingDogOperationsOperations(HierarchyBuildingClientTestBa
1717
def test_dog_operations_update_dog_as_dog(self, hierarchybuilding_endpoint):
1818
client = self.create_client(endpoint=hierarchybuilding_endpoint)
1919
response = client.dog_operations.update_dog_as_dog(
20-
dog={
21-
"breed": "str",
22-
"kind": "dog",
23-
"name": "str",
24-
"trained": bool
25-
}
26-
,
20+
dog={"breed": "str", "kind": "dog", "name": "str", "trained": bool},
2721
)
28-
22+
2923
# please add some check logic here by yourself
3024
# ...
31-

packages/typespec-python/test/azure/generated/azure-client-generator-core-hierarchy-building/generated_tests/test_hierarchy_building_dog_operations_operations_async.py

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,8 @@ class TestHierarchyBuildingDogOperationsOperationsAsync(HierarchyBuildingClientT
1818
async def test_dog_operations_update_dog_as_dog(self, hierarchybuilding_endpoint):
1919
client = self.create_async_client(endpoint=hierarchybuilding_endpoint)
2020
response = await client.dog_operations.update_dog_as_dog(
21-
dog={
22-
"breed": "str",
23-
"kind": "dog",
24-
"name": "str",
25-
"trained": bool
26-
}
27-
,
21+
dog={"breed": "str", "kind": "dog", "name": "str", "trained": bool},
2822
)
29-
23+
3024
# please add some check logic here by yourself
3125
# ...
32-

packages/typespec-python/test/azure/generated/azure-client-generator-core-hierarchy-building/generated_tests/test_hierarchy_building_pet_operations_operations.py

Lines changed: 4 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,9 @@ class TestHierarchyBuildingPetOperationsOperations(HierarchyBuildingClientTestBa
1717
def test_pet_operations_update_pet_as_pet(self, hierarchybuilding_endpoint):
1818
client = self.create_client(endpoint=hierarchybuilding_endpoint)
1919
response = client.pet_operations.update_pet_as_pet(
20-
pet={
21-
"breed": "str",
22-
"kind": "dog",
23-
"name": "str",
24-
"trained": bool
25-
}
26-
,
20+
pet={"breed": "str", "kind": "dog", "name": "str", "trained": bool},
2721
)
28-
22+
2923
# please add some check logic here by yourself
3024
# ...
3125

@@ -34,15 +28,8 @@ def test_pet_operations_update_pet_as_pet(self, hierarchybuilding_endpoint):
3428
def test_pet_operations_update_dog_as_pet(self, hierarchybuilding_endpoint):
3529
client = self.create_client(endpoint=hierarchybuilding_endpoint)
3630
response = client.pet_operations.update_dog_as_pet(
37-
pet={
38-
"breed": "str",
39-
"kind": "dog",
40-
"name": "str",
41-
"trained": bool
42-
}
43-
,
31+
pet={"breed": "str", "kind": "dog", "name": "str", "trained": bool},
4432
)
45-
33+
4634
# please add some check logic here by yourself
4735
# ...
48-

packages/typespec-python/test/azure/generated/azure-client-generator-core-hierarchy-building/generated_tests/test_hierarchy_building_pet_operations_operations_async.py

Lines changed: 4 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,9 @@ class TestHierarchyBuildingPetOperationsOperationsAsync(HierarchyBuildingClientT
1818
async def test_pet_operations_update_pet_as_pet(self, hierarchybuilding_endpoint):
1919
client = self.create_async_client(endpoint=hierarchybuilding_endpoint)
2020
response = await client.pet_operations.update_pet_as_pet(
21-
pet={
22-
"breed": "str",
23-
"kind": "dog",
24-
"name": "str",
25-
"trained": bool
26-
}
27-
,
21+
pet={"breed": "str", "kind": "dog", "name": "str", "trained": bool},
2822
)
29-
23+
3024
# please add some check logic here by yourself
3125
# ...
3226

@@ -35,15 +29,8 @@ async def test_pet_operations_update_pet_as_pet(self, hierarchybuilding_endpoint
3529
async def test_pet_operations_update_dog_as_pet(self, hierarchybuilding_endpoint):
3630
client = self.create_async_client(endpoint=hierarchybuilding_endpoint)
3731
response = await client.pet_operations.update_dog_as_pet(
38-
pet={
39-
"breed": "str",
40-
"kind": "dog",
41-
"name": "str",
42-
"trained": bool
43-
}
44-
,
32+
pet={"breed": "str", "kind": "dog", "name": "str", "trained": bool},
4533
)
46-
34+
4735
# please add some check logic here by yourself
4836
# ...
49-

pnpm-lock.yaml

Lines changed: 8 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)