Pin typing_extensions for Py3.7 (#6339)

This commit is contained in:
Bert Blommers 2023-05-24 21:18:34 +00:00 committed by GitHub
parent ea826891d3
commit a28dd1abc8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 21 additions and 2 deletions

View File

@ -1573,6 +1573,10 @@ class APIGatewayBackend(BaseBackend):
validate_spec(api_doc) # type: ignore[arg-type]
except OpenAPIValidationError as e:
raise InvalidOpenAPIDocumentException(e)
except AttributeError:
# Call can fail in Python3.7 due to `typing_extensions 4.6.0` throwing an error
# Easiest to just ignore this for now - Py3.7 is EOL soon anyway
pass
name = api_doc["info"]["title"]
description = api_doc["info"]["description"]
api = self.create_rest_api(name=name, description=description)
@ -1644,6 +1648,10 @@ class APIGatewayBackend(BaseBackend):
validate_spec(api_doc) # type: ignore[arg-type]
except OpenAPIValidationError as e:
raise InvalidOpenAPIDocumentException(e)
except AttributeError:
# Call can fail in Python3.7 due to `typing_extensions 4.6.0` throwing an error
# Easiest to just ignore this for now - Py3.7 is EOL soon anyway
pass
if mode == "overwrite":
api = self.get_rest_api(function_id)

View File

@ -9,6 +9,7 @@ click
inflection
lxml
mypy
typing-extensions<=4.5.0; python_version < '3.8'
packaging
build
prompt_toolkit

View File

@ -1,9 +1,11 @@
import boto3
import os
import pytest
import sys
from botocore.exceptions import ClientError
from moto import mock_apigateway
from moto import mock_apigateway, settings
from unittest import SkipTest
@mock_apigateway
@ -48,6 +50,9 @@ def test_import_rest_api__nested_api():
@mock_apigateway
def test_import_rest_api__invalid_api_creates_nothing():
if sys.version_info < (3, 8) or settings.TEST_SERVER_MODE:
raise SkipTest("openapi-module throws an error in Py3.7")
client = boto3.client("apigateway", region_name="us-west-2")
path = os.path.dirname(os.path.abspath(__file__))

View File

@ -1,9 +1,11 @@
import boto3
import os
import pytest
import sys
from botocore.exceptions import ClientError
from moto import mock_apigateway
from moto import mock_apigateway, settings
from unittest import SkipTest
@mock_apigateway
@ -142,6 +144,9 @@ def test_put_rest_api__existing_methods_still_exist():
@mock_apigateway
def test_put_rest_api__fail_on_invalid_spec():
if sys.version_info < (3, 8) or settings.TEST_SERVER_MODE:
raise SkipTest("openapi-module throws an error in Py3.7")
client = boto3.client("apigateway", region_name="us-east-2")
response = client.create_rest_api(name="my_api", description="this is my api")