From e64c76c7fd2b3426f482315bcd85ba422ca374bd Mon Sep 17 00:00:00 2001 From: Muhammad Farhan Date: Wed, 25 Sep 2024 16:56:41 +0500 Subject: [PATCH] fix: remove moto<5.0 constraint and update dependencies --- requirements/base.txt | 9 ++- requirements/constraints.txt | 4 - requirements/pip.txt | 4 +- requirements/pip_tools.txt | 11 ++- requirements/test.txt | 102 ++++++++++++++---------- scripts/aws/bootstrap.py | 1 + scripts/aws/tests/test_bootstrap.py | 1 - scripts/aws/tests/test_deploy_common.py | 10 +-- scripts/aws/tests/test_flip.py | 1 - 9 files changed, 87 insertions(+), 56 deletions(-) diff --git a/requirements/base.txt b/requirements/base.txt index df7befa..d5590c1 100644 --- a/requirements/base.txt +++ b/requirements/base.txt @@ -6,9 +6,9 @@ # boto==2.49.0 # via google-compute-engine -boto3==1.35.6 +boto3==1.35.26 # via -r requirements/base.in -botocore==1.35.6 +botocore==1.35.26 # via # -r requirements/base.in # boto3 @@ -17,6 +17,7 @@ distro==1.9.0 # via google-compute-engine google-compute-engine==2.8.13 # via -r requirements/base.in +jinja2==3.1.4 jinja2==3.1.4 # via -r requirements/base.in jmespath==1.0.1 @@ -26,15 +27,17 @@ jmespath==1.0.1 # botocore markupsafe==2.1.5 # via jinja2 +python-dateutil==2.9.0.post0 python-dateutil==2.9.0.post0 # via botocore +s3transfer==0.10.2 s3transfer==0.10.2 # via boto3 six==1.16.0 # via # -r requirements/base.in # python-dateutil -urllib3==2.2.2 +urllib3==1.26.20 # via botocore # The following packages are considered to be unsafe in a requirements file: diff --git a/requirements/constraints.txt b/requirements/constraints.txt index 975a11c..f9ea41a 100644 --- a/requirements/constraints.txt +++ b/requirements/constraints.txt @@ -10,7 +10,3 @@ # This file contains all common constraints for edx-repos -c https://raw.githubusercontent.com/edx/edx-lint/master/edx_lint/files/common_constraints.txt - -# moto==5.0 contains breaking changes in test env -# neeeds to be fixed in a separate pr -moto<5.0 diff --git a/requirements/pip.txt b/requirements/pip.txt index f0fca18..0f1d505 100644 --- a/requirements/pip.txt +++ b/requirements/pip.txt @@ -4,11 +4,13 @@ # # make upgrade # +wheel==0.44.0 wheel==0.44.0 # via -r requirements/pip.in # The following packages are considered to be unsafe in a requirements file: +pip==24.2 pip==24.2 # via -r requirements/pip.in -setuptools==73.0.1 +setuptools==75.1.0 # via -r requirements/pip.in diff --git a/requirements/pip_tools.txt b/requirements/pip_tools.txt index 4922d28..b0153a4 100644 --- a/requirements/pip_tools.txt +++ b/requirements/pip_tools.txt @@ -4,20 +4,29 @@ # # make upgrade # -build==1.2.1 +build==1.2.2 # via pip-tools click==8.1.7 # via pip-tools +importlib-metadata==8.5.0 + # via build packaging==24.1 # via build pip-tools==7.4.1 # via -r requirements/pip_tools.in pyproject-hooks==1.1.0 +pyproject-hooks==1.1.0 + # via + # build + # pip-tools +tomli==2.0.1 # via # build # pip-tools wheel==0.44.0 # via pip-tools +zipp==3.20.2 + # via importlib-metadata # The following packages are considered to be unsafe in a requirements file: # pip diff --git a/requirements/test.txt b/requirements/test.txt index 4f068f0..6dee29d 100644 --- a/requirements/test.txt +++ b/requirements/test.txt @@ -4,72 +4,80 @@ # # make upgrade # +annotated-types==0.7.0 annotated-types==0.7.0 # via pydantic +astroid==3.2.4 astroid==3.2.4 # via pylint +attrs==24.2.0 attrs==24.2.0 # via # jsonschema # referencing +aws-sam-translator==1.91.0 aws-sam-translator==1.91.0 # via cfn-lint +aws-xray-sdk==2.14.0 aws-xray-sdk==2.14.0 # via moto boto==2.49.0 # via # -r requirements/base.txt # google-compute-engine -boto3==1.35.6 +boto3==1.35.26 # via # -r requirements/base.txt # aws-sam-translator # moto -botocore==1.35.6 +botocore==1.35.26 # via # -r requirements/base.txt # aws-xray-sdk # boto3 # moto # s3transfer -certifi==2024.7.4 +certifi==2024.8.30 # via requests -cffi==1.17.0 +cffi==1.17.1 # via cryptography -cfn-lint==1.10.3 +cfn-lint==1.15.1 # via moto charset-normalizer==3.3.2 # via requests -cryptography==43.0.0 +cryptography==43.0.1 # via + # joserfc # moto - # python-jose - # sshpubkeys dill==0.3.8 # via pylint distro==1.9.0 # via # -r requirements/base.txt # google-compute-engine +docker==7.1.0 docker==7.1.0 # via moto -ecdsa==0.19.0 - # via - # moto - # python-jose - # sshpubkeys +exceptiongroup==1.2.2 + # via pytest future==1.0.0 # via pyresttest google-compute-engine==2.8.13 # via -r requirements/base.txt -graphql-core==3.2.3 +graphql-core==3.2.4 # via moto -idna==3.8 +idna==3.10 # via requests +importlib-resources==6.4.5 + # via + # jsonschema + # jsonschema-specifications + # openapi-spec-validator iniconfig==2.0.0 # via pytest isort==5.13.2 # via pylint +jinja2==3.1.4 jinja2==3.1.4 # via # -r requirements/base.txt @@ -79,17 +87,22 @@ jmespath==1.0.1 # -r requirements/base.txt # boto3 # botocore -jsondiff==2.2.0 +joserfc==1.0.0 + # via moto +jsondiff==2.2.1 # via moto jsonpatch==1.33 # via cfn-lint +jsonpointer==3.0.0 jsonpointer==3.0.0 # via jsonpatch +jsonschema==4.23.0 jsonschema==4.23.0 # via # aws-sam-translator # openapi-schema-validator # openapi-spec-validator +jsonschema-path==0.3.3 jsonschema-path==0.3.3 # via openapi-spec-validator jsonschema-specifications==2023.12.1 @@ -107,10 +120,8 @@ mccabe==0.7.0 # via pylint mock==5.1.0 # via -r requirements/test.in -moto[cloudformation]==4.2.14 - # via - # -c requirements/constraints.txt - # -r requirements/test.in +moto[cloudformation]==5.0.15 + # via -r requirements/test.in mpmath==1.3.0 # via sympy networkx==3.3 @@ -121,74 +132,78 @@ openapi-spec-validator==0.7.1 # via moto packaging==24.1 # via pytest +packaging==24.1 + # via pytest pathable==0.4.3 # via jsonschema-path pep8==1.7.1 # via -r requirements/test.in -platformdirs==4.2.2 +pkgutil-resolve-name==1.3.10 + # via jsonschema +platformdirs==4.3.6 # via pylint +pluggy==1.5.0 pluggy==1.5.0 # via pytest -py-partiql-parser==0.5.0 +py-partiql-parser==0.5.6 # via moto -pyasn1==0.6.0 - # via - # python-jose - # rsa pycparser==2.22 # via cffi pycurl==7.45.3 # via pyresttest -pydantic==2.8.2 +pydantic==2.9.2 # via aws-sam-translator -pydantic-core==2.20.1 +pydantic-core==2.23.4 # via pydantic -pylint==3.2.6 +pylint==3.2.7 # via -r requirements/test.in +pyparsing==3.1.4 pyparsing==3.1.4 # via moto pyresttest==1.7.1 # via -r requirements/test.in -pytest==8.3.2 +pytest==8.3.3 # via -r requirements/test.in +python-dateutil==2.9.0.post0 python-dateutil==2.9.0.post0 # via # -r requirements/base.txt # botocore # moto -python-jose[cryptography]==3.3.0 - # via moto pyyaml==6.0.2 # via # cfn-lint # jsondiff + # jsondiff # jsonschema-path # moto # pyresttest # responses +referencing==0.35.1 referencing==0.35.1 # via # jsonschema # jsonschema-path # jsonschema-specifications -regex==2024.7.24 +regex==2024.9.11 # via cfn-lint +requests==2.32.3 requests==2.32.3 # via # docker # jsonschema-path # moto # responses +responses==0.25.3 responses==0.25.3 # via moto rfc3339-validator==0.1.4 # via openapi-schema-validator +rpds-py==0.20.0 rpds-py==0.20.0 # via # jsonschema # referencing -rsa==4.9 - # via python-jose s3transfer==0.10.2 # via # -r requirements/base.txt @@ -196,34 +211,41 @@ s3transfer==0.10.2 six==1.16.0 # via # -r requirements/base.txt - # ecdsa # python-dateutil # rfc3339-validator -sshpubkeys==3.3.1 - # via moto -sympy==1.13.2 +sympy==1.13.3 # via cfn-lint +tomli==2.0.1 + # via + # pylint + # pytest tomlkit==0.13.2 # via pylint +typing-extensions==4.12.2 typing-extensions==4.12.2 # via # aws-sam-translator # cfn-lint + # cfn-lint # pydantic # pydantic-core -urllib3==2.2.2 + # pylint +urllib3==1.26.20 # via # -r requirements/base.txt # botocore # docker # requests # responses +werkzeug==3.0.4 werkzeug==3.0.4 # via moto wrapt==1.16.0 # via aws-xray-sdk xmltodict==0.13.0 # via moto +zipp==3.20.2 + # via importlib-resources # The following packages are considered to be unsafe in a requirements file: # setuptools diff --git a/scripts/aws/bootstrap.py b/scripts/aws/bootstrap.py index a7824ab..1c61a6b 100755 --- a/scripts/aws/bootstrap.py +++ b/scripts/aws/bootstrap.py @@ -14,6 +14,7 @@ def get_domain(api_base): """Returns a dictionary response for the specified domain or None if the domain does not exit""" + client = boto3.client('apigateway', region_name=args.aws_region) # pylint: disable=possibly-used-before-assignment try: diff --git a/scripts/aws/tests/test_bootstrap.py b/scripts/aws/tests/test_bootstrap.py index ebfde13..1763155 100644 --- a/scripts/aws/tests/test_bootstrap.py +++ b/scripts/aws/tests/test_bootstrap.py @@ -3,7 +3,6 @@ """ import boto3 import pytest -from moto import mock_apigateway, mock_route53 from unittest import TestCase from bootstrap import get_domain, get_base_path, create_apigw_custom_domain_name,\ create_route53_rs, bootstrap_api, create_base_path_mapping, file_arg_to_string diff --git a/scripts/aws/tests/test_deploy_common.py b/scripts/aws/tests/test_deploy_common.py index 84af2f0..b812cc6 100644 --- a/scripts/aws/tests/test_deploy_common.py +++ b/scripts/aws/tests/test_deploy_common.py @@ -3,7 +3,7 @@ """ import boto3 import pytest -from moto import mock_apigateway +from moto import mock_aws from unittest import TestCase from common.deploy import get_api_id, get_next_stage, deploy_api, update_stage @@ -13,7 +13,7 @@ class DeployTest(TestCase): TestCase class for testing deploy.py """ - @mock_apigateway + @mock_aws def setUp(self): self.rotation = ['red', 'black', 'turquoise'] self.current_stage = 'black' @@ -21,7 +21,7 @@ def setUp(self): self.swagger_filename = 'fixtures/swagger.json' @pytest.mark.skip(reason="moto does not yet support AWS:ApiGateway:GetBasePathMapping") - @mock_apigateway + @mock_aws def test_get_api_id(self): pass @@ -45,11 +45,11 @@ def test_get_next_stage(self): get_next_stage([], 'red') @pytest.mark.skip(reason="moto does not yet support AWS:ApiGateway:PutRestApi") - @mock_apigateway + @mock_aws def test_deploy_api(self): pass @pytest.mark.skip(reason="moto does not yet support AWS:ApiGateway:UpdateStage") - @mock_apigateway + @mock_aws def test_update_stage(self): pass diff --git a/scripts/aws/tests/test_flip.py b/scripts/aws/tests/test_flip.py index 6098a8f..543ffac 100644 --- a/scripts/aws/tests/test_flip.py +++ b/scripts/aws/tests/test_flip.py @@ -3,7 +3,6 @@ """ import boto3 import pytest -from moto import mock_apigateway from unittest import TestCase from flip import get_live_stage, update_base_path_mapping