diff --git a/.chronus/changes/python-usage-namespace-test-2026-5-26-23-18-25.md b/.chronus/changes/python-usage-namespace-test-2026-5-26-23-18-25.md new file mode 100644 index 00000000000..255a67569a5 --- /dev/null +++ b/.chronus/changes/python-usage-namespace-test-2026-5-26-23-18-25.md @@ -0,0 +1,7 @@ +--- +changeKind: internal +packages: + - "@typespec/http-client-python" +--- + +Add sync and async mock API tests for the Azure client-generator-core usage namespace usage scenario from azure-http-specs. diff --git a/packages/http-client-python/package-lock.json b/packages/http-client-python/package-lock.json index cc9078bf7e4..10a7f975977 100644 --- a/packages/http-client-python/package-lock.json +++ b/packages/http-client-python/package-lock.json @@ -17,7 +17,7 @@ "tsx": "^4.21.0" }, "devDependencies": { - "@azure-tools/azure-http-specs": "0.1.0-alpha.41-dev.1", + "@azure-tools/azure-http-specs": "^0.1.0-alpha.41-dev.2", "@azure-tools/typespec-autorest": "~0.68.0", "@azure-tools/typespec-azure-core": "~0.68.0", "@azure-tools/typespec-azure-resource-manager": "~0.68.0", @@ -66,9 +66,9 @@ } }, "node_modules/@azure-tools/azure-http-specs": { - "version": "0.1.0-alpha.41-dev.1", - "resolved": "https://registry.npmjs.org/@azure-tools/azure-http-specs/-/azure-http-specs-0.1.0-alpha.41-dev.1.tgz", - "integrity": "sha512-GaFmm7KP19YtxgdE2eyA37XusQCqoxo7UA6Lj9iLnXE77XPeDppE1pKstWFAbMcv/Jrc/EGqkl+TOGApej/JoA==", + "version": "0.1.0-alpha.41-dev.2", + "resolved": "https://registry.npmjs.org/@azure-tools/azure-http-specs/-/azure-http-specs-0.1.0-alpha.41-dev.2.tgz", + "integrity": "sha512-bx3thSgOwuLjqiYbyFal6d7q29Wo8lyNCVs8CIgoZzOievXM7dzJTfCI1RplPYydObcMeYAnAaPH32/YoFj93w==", "dev": true, "license": "MIT", "dependencies": { diff --git a/packages/http-client-python/package.json b/packages/http-client-python/package.json index ef31a825df2..5146ccc8acc 100644 --- a/packages/http-client-python/package.json +++ b/packages/http-client-python/package.json @@ -66,13 +66,13 @@ "@azure-tools/typespec-azure-rulesets": ">=0.68.0 <1.0.0", "@azure-tools/typespec-client-generator-core": ">=0.68.0 <1.0.0", "@typespec/compiler": "^1.12.0", + "@typespec/events": ">=0.82.0 <1.0.0", "@typespec/http": "^1.12.0", "@typespec/openapi": "^1.12.0", "@typespec/rest": ">=0.82.0 <1.0.0", - "@typespec/versioning": ">=0.82.0 <1.0.0", - "@typespec/events": ">=0.82.0 <1.0.0", "@typespec/sse": ">=0.82.0 <1.0.0", "@typespec/streams": ">=0.82.0 <1.0.0", + "@typespec/versioning": ">=0.82.0 <1.0.0", "@typespec/xml": ">=0.82.0 <1.0.0" }, "playgroundConfig": { @@ -98,27 +98,27 @@ "tsx": "^4.21.0" }, "devDependencies": { + "@azure-tools/azure-http-specs": "^0.1.0-alpha.41-dev.2", "@azure-tools/typespec-autorest": "~0.68.0", "@azure-tools/typespec-azure-core": "~0.68.0", "@azure-tools/typespec-azure-resource-manager": "~0.68.0", "@azure-tools/typespec-azure-rulesets": "~0.68.0", "@azure-tools/typespec-client-generator-core": "~0.68.2", - "@azure-tools/azure-http-specs": "0.1.0-alpha.41-dev.1", + "@types/js-yaml": "~4.0.5", + "@types/node": "~25.0.2", + "@types/semver": "7.5.8", "@typespec/compiler": "^1.12.0", + "@typespec/events": "~0.82.0", "@typespec/http": "^1.12.0", + "@typespec/http-specs": "0.1.0-alpha.37", "@typespec/openapi": "^1.12.0", "@typespec/rest": "~0.82.0", - "@typespec/versioning": "~0.82.0", - "@typespec/events": "~0.82.0", - "@typespec/spector": "0.1.0-alpha.25", "@typespec/spec-api": "0.1.0-alpha.14", + "@typespec/spector": "0.1.0-alpha.25", "@typespec/sse": "~0.82.0", "@typespec/streams": "~0.82.0", + "@typespec/versioning": "~0.82.0", "@typespec/xml": "~0.82.0", - "@typespec/http-specs": "0.1.0-alpha.37", - "@types/js-yaml": "~4.0.5", - "@types/node": "~25.0.2", - "@types/semver": "7.5.8", "c8": "^10.1.3", "picocolors": "~1.1.1", "rimraf": "~6.1.2", diff --git a/packages/http-client-python/tests/mock_api/azure/asynctests/test_azure_client_generator_core_usage_async.py b/packages/http-client-python/tests/mock_api/azure/asynctests/test_azure_client_generator_core_usage_async.py index 816279eeb94..9a82c7e573a 100644 --- a/packages/http-client-python/tests/mock_api/azure/asynctests/test_azure_client_generator_core_usage_async.py +++ b/packages/http-client-python/tests/mock_api/azure/asynctests/test_azure_client_generator_core_usage_async.py @@ -37,3 +37,9 @@ async def test_orphan_model_serializable(client: UsageClient): await client.model_in_operation.orphan_model_serializable( body=models.OrphanModel(model_name="name", description="desc") ) + + +@pytest.mark.asyncio +async def test_namespace_model_serializable(client: UsageClient): + namespace_model = models.NamespaceModel(name="test") + await client.namespace_usage.namespace_model_serializable(body=namespace_model) diff --git a/packages/http-client-python/tests/mock_api/azure/test_azure_client_generator_core_usage.py b/packages/http-client-python/tests/mock_api/azure/test_azure_client_generator_core_usage.py index 0094bef89a1..4bc9b912324 100644 --- a/packages/http-client-python/tests/mock_api/azure/test_azure_client_generator_core_usage.py +++ b/packages/http-client-python/tests/mock_api/azure/test_azure_client_generator_core_usage.py @@ -30,3 +30,8 @@ def test_model_usage(client: UsageClient): def test_orphan_model_serializable(client: UsageClient): client.model_in_operation.orphan_model_serializable(body=models.OrphanModel(model_name="name", description="desc")) + + +def test_namespace_model_serializable(client: UsageClient): + namespace_model = models.NamespaceModel(name="test") + client.namespace_usage.namespace_model_serializable(body=namespace_model)