Skip to content
This repository was archived by the owner on May 22, 2026. It is now read-only.

Commit 8388144

Browse files
AutoPrFromHttpClientPythonAutoPrFromHttpClientPython
authored andcommitted
Sync shared files from typespec repo (2026-05-21 00:07:16)
1 parent ff6b53c commit 8388144

5 files changed

Lines changed: 50 additions & 4 deletions

File tree

packages/typespec-python/tests/mock_api/shared/test_generation_subdir2_for_generated_code.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,4 @@ def test_v2(client: AddedClient):
3030
def test_interface_v2(client: AddedClient):
3131
assert client.interface_v2.v2_in_interface(
3232
ModelV2(prop="foo", enum_prop=EnumV2.ENUM_MEMBER, union_prop="bar")
33-
) == ModelV2(prop="foo", enum_prop=EnumV2.ENUM_MEMBER, union_prop="bar")
33+
) == ModelV2(prop="foo", enum_prop=EnumV2.ENUM_MEMBER, union_prop="bar")

packages/typespec-python/tests/mock_api/shared/test_generation_subdir_for_generated_code.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,4 @@ def test_custom_method():
1414
"level": 0,
1515
"extension": [{"level": 1, "extension": [{"level": 2}]}, {"level": 1}],
1616
}
17-
)
17+
)

packages/typespec-python/tests/mock_api/shared/test_patch.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,4 @@ def test_patch_mixin_operation_group_in_operations_folder(key_credential):
99
from authentication.apikey import ApiKeyClient, aio
1010

1111
assert hasattr(ApiKeyClient(key_credential), "patch_added_operation")
12-
assert hasattr(aio.ApiKeyClient(key_credential), "patch_added_operation")
12+
assert hasattr(aio.ApiKeyClient(key_credential), "patch_added_operation")

packages/typespec-python/tests/mock_api/shared/unittests/test_parse_pyproject.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,4 +92,4 @@ def test_azure_sdk_build():
9292
), f"[tool.azure-sdk-build] section does not contain 'pyright' setting in {package_path}"
9393
assert (
9494
azure_sdk_build["pyright"] is False
95-
), f"Expected pyright = false, but got pyright = {azure_sdk_build['pyright']} in {package_path}"
95+
), f"Expected pyright = false, but got pyright = {azure_sdk_build['pyright']} in {package_path}"
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
from pathlib import Path
2+
3+
import pytest
4+
5+
GENERATED_DIR = Path(__file__).parent / "../../../generated"
6+
FLAVORS = ("azure", "unbranded")
7+
8+
# Folders that exist in the azure-sdk-for-python baseline checkout but are not
9+
# regenerated by the emitter, so their README.md is never (re)written. Skip
10+
# them to keep this test focused on real generated packages.
11+
# - "azure/service-multiple-services": listed in SKIP_SPECS in
12+
# eng/scripts/ci/regenerate-common.ts (no emitter run for this spec).
13+
# - "azure/azure-client-generator-core-client-initialization": orphan parent
14+
# folder; only its sub-specs (.../default, .../individually,
15+
# .../individuallyParent) are actually emitted as packages.
16+
SKIP_PACKAGES = {
17+
("azure", "service-multiple-services"),
18+
("azure", "azure-client-generator-core-client-initialization"),
19+
}
20+
21+
22+
def _package_dirs():
23+
base = GENERATED_DIR.resolve()
24+
dirs = []
25+
for flavor in FLAVORS:
26+
flavor_dir = base / flavor
27+
if not flavor_dir.is_dir():
28+
continue
29+
for p in sorted(flavor_dir.iterdir()):
30+
if not p.is_dir():
31+
continue
32+
if (flavor, p.name) in SKIP_PACKAGES:
33+
continue
34+
dirs.append(p)
35+
return dirs
36+
37+
38+
@pytest.mark.parametrize(
39+
"package_dir",
40+
_package_dirs(),
41+
ids=lambda p: f"{p.parent.name}/{p.name}",
42+
)
43+
def test_readme_exists(package_dir: Path):
44+
"""Each generated SDK package folder (azure & unbranded) must contain a README.md."""
45+
readme_path = package_dir / "README.md"
46+
assert readme_path.is_file(), f"README.md not found at {readme_path}"

0 commit comments

Comments
 (0)