From 53209e43cbf71482cc4c59acae7f9934918d400d Mon Sep 17 00:00:00 2001 From: Yuchao Yan Date: Fri, 10 Apr 2026 10:14:38 +0800 Subject: [PATCH] =?UTF-8?q?Revert=20"[python]=20Add=20mock=20API=20tests?= =?UTF-8?q?=20for=20service/multiple-services=20Spector=20sce=E2=80=A6"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit 75c3b35a117d41859c5ac5142fdba5451ebf97ba. --- ...vice-multiple-services-2026-4-2-22-40-0.md | 7 --- .../eng/scripts/ci/regenerate-common.ts | 3 -- .../test_service_multiple_services_async.py | 44 ------------------- .../azure/test_service_multiple_services.py | 40 ----------------- 4 files changed, 94 deletions(-) delete mode 100644 .chronus/changes/python-add-test-service-multiple-services-2026-4-2-22-40-0.md delete mode 100644 packages/http-client-python/tests/mock_api/azure/asynctests/test_service_multiple_services_async.py delete mode 100644 packages/http-client-python/tests/mock_api/azure/test_service_multiple_services.py diff --git a/.chronus/changes/python-add-test-service-multiple-services-2026-4-2-22-40-0.md b/.chronus/changes/python-add-test-service-multiple-services-2026-4-2-22-40-0.md deleted file mode 100644 index c44dbc0cbb4..00000000000 --- a/.chronus/changes/python-add-test-service-multiple-services-2026-4-2-22-40-0.md +++ /dev/null @@ -1,7 +0,0 @@ ---- -changeKind: internal -packages: - - "@typespec/http-client-python" ---- - -Add mock API tests for `service/multiple-services` scenario (multiple services without explicit `@client`). diff --git a/packages/http-client-python/eng/scripts/ci/regenerate-common.ts b/packages/http-client-python/eng/scripts/ci/regenerate-common.ts index 0bcce983788..d0357fc3c29 100644 --- a/packages/http-client-python/eng/scripts/ci/regenerate-common.ts +++ b/packages/http-client-python/eng/scripts/ci/regenerate-common.ts @@ -135,9 +135,6 @@ export const BASE_AZURE_EMITTER_OPTIONS: Record< "service/multi-service": { namespace: "service.multiservice", }, - "service/multiple-services": { - namespace: "service.multipleservices", - }, }; export const BASE_EMITTER_OPTIONS: Record< diff --git a/packages/http-client-python/tests/mock_api/azure/asynctests/test_service_multiple_services_async.py b/packages/http-client-python/tests/mock_api/azure/asynctests/test_service_multiple_services_async.py deleted file mode 100644 index 4121e327976..00000000000 --- a/packages/http-client-python/tests/mock_api/azure/asynctests/test_service_multiple_services_async.py +++ /dev/null @@ -1,44 +0,0 @@ -# ------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -------------------------------------------------------------------------- -import pytest -from azure.core.exceptions import HttpResponseError -from service.multipleservices.aio import ServiceAClient, ServiceBClient -from service.multipleservices.models import VersionsB - - -@pytest.fixture -def service_b_client(): - """Fixture that creates a ServiceBClient for testing.""" - return ServiceBClient(endpoint="http://localhost:3000") - - -@pytest.mark.asyncio -async def test_service_multiple_services_both_clients_exist(): - """Verify that multiple services without explicit @client create separate root clients.""" - async with ServiceAClient(endpoint="http://localhost:3000") as a_client: - assert a_client is not None - async with ServiceBClient(endpoint="http://localhost:3000") as b_client: - assert b_client is not None - - -@pytest.mark.asyncio -async def test_service_multiple_services_operation_b(service_b_client): - async with service_b_client: - async with ServiceBClient(endpoint="http://localhost:3000", api_version=VersionsB.BV1) as wrong_client: - with pytest.raises(HttpResponseError): - await wrong_client.operations.op_b() - - await service_b_client.operations.op_b() - - -@pytest.mark.asyncio -async def test_service_multiple_services_sub_namespace_operation_b(service_b_client): - async with service_b_client: - async with ServiceBClient(endpoint="http://localhost:3000", api_version=VersionsB.BV1) as wrong_client: - with pytest.raises(HttpResponseError): - await wrong_client.sub_namespace.sub_op_b() - - await service_b_client.sub_namespace.sub_op_b() diff --git a/packages/http-client-python/tests/mock_api/azure/test_service_multiple_services.py b/packages/http-client-python/tests/mock_api/azure/test_service_multiple_services.py deleted file mode 100644 index 0ce6df2cff5..00000000000 --- a/packages/http-client-python/tests/mock_api/azure/test_service_multiple_services.py +++ /dev/null @@ -1,40 +0,0 @@ -# ------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -------------------------------------------------------------------------- -import pytest -from azure.core.exceptions import HttpResponseError -from service.multipleservices import ServiceAClient, ServiceBClient -from service.multipleservices.models import VersionsB - - -@pytest.fixture -def service_b_client(): - """Fixture that creates a ServiceBClient for testing.""" - with ServiceBClient(endpoint="http://localhost:3000") as client: - yield client - - -def test_service_multiple_services_both_clients_exist(): - """Verify that multiple services without explicit @client create separate root clients.""" - with ServiceAClient(endpoint="http://localhost:3000") as a_client: - assert a_client is not None - with ServiceBClient(endpoint="http://localhost:3000") as b_client: - assert b_client is not None - - -def test_service_multiple_services_operation_b(service_b_client): - with ServiceBClient(endpoint="http://localhost:3000", api_version=VersionsB.BV1) as wrong_client: - with pytest.raises(HttpResponseError): - wrong_client.operations.op_b() - - service_b_client.operations.op_b() - - -def test_service_multiple_services_sub_namespace_operation_b(service_b_client): - with ServiceBClient(endpoint="http://localhost:3000", api_version=VersionsB.BV1) as wrong_client: - with pytest.raises(HttpResponseError): - wrong_client.sub_namespace.sub_op_b() - - service_b_client.sub_namespace.sub_op_b()