diff --git a/requirements-dev.in b/requirements-dev.in index 9c62df01..c48f975f 100644 --- a/requirements-dev.in +++ b/requirements-dev.in @@ -1,24 +1,24 @@ awscli~=1.31.13 certifi~=2023.7.22 check-manifest~=0.48 -mypy~=0.961 +mypy~=1.10 myst-parser~=0.18.0 -pip-tools~=6.14.0 -pydot~=1.4.2 +pip-tools~=7.4.1 +pydot~=2.0.0 pyroma~=4.0 -pytest~=7.2.0 -pytest-cov~=4.0.0 -pytest-mock~=3.10.0 +pytest~=8.2.2 +pytest-cov~=5.0.0 +pytest-mock~=3.14.0 pytest-ordering~=0.6 -ruff~=0.4.4 -twine~=4.0.1 -types-PyYAML~=6.0.8 -types-setuptools~=57.4.17 +ruff~=0.4.8 +twine~=5.1.0 +types-PyYAML~=6.0.12 +types-setuptools~=70.0.0 wheel~=0.38.1 sphinx-autoapi~=1.8.0 sphinx-rtd-theme~=1.0.0 sphinx~=4.3.0 -moto[s3,sts,iam,codebuild,secretsmanager,ssm]~=4.0.9 +moto[s3,sts,iam,codebuild,secretsmanager,ssm]~=5.0.9 requests~=2.32.0 werkzeug~=3.0.3 urllib3~=1.26.18 \ No newline at end of file diff --git a/requirements-dev.txt b/requirements-dev.txt index c51189c5..60551c31 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -1,5 +1,5 @@ # -# This file is autogenerated by pip-compile with Python 3.12 +# This file is autogenerated by pip-compile with Python 3.8 # by the following command: # # pip-compile --output-file=requirements-dev.txt requirements-dev.in @@ -8,8 +8,6 @@ alabaster==0.7.13 # via sphinx astroid==2.15.8 # via sphinx-autoapi -attrs==23.2.0 - # via pytest awscli==1.31.13 # via -r requirements-dev.in babel==2.14.0 @@ -24,7 +22,7 @@ botocore==1.33.13 # boto3 # moto # s3transfer -build==0.10.0 +build==1.2.1 # via # check-manifest # pip-tools @@ -46,9 +44,7 @@ colorama==0.4.4 coverage[toml]==7.2.7 # via pytest-cov cryptography==42.0.4 - # via - # moto - # secretstorage + # via moto docutils==0.16 # via # awscli @@ -57,20 +53,21 @@ docutils==0.16 # readme-renderer # sphinx # sphinx-rtd-theme +exceptiongroup==1.2.1 + # via pytest idna==3.7 # via requests imagesize==1.4.1 # via sphinx -importlib-metadata==4.2.0 - # via twine +importlib-metadata==7.1.0 + # via + # build + # keyring + # twine iniconfig==2.0.0 # via pytest jaraco-classes==3.2.3 # via keyring -jeepney==0.8.0 - # via - # keyring - # secretstorage jinja2==3.1.3 # via # moto @@ -93,7 +90,6 @@ markdown-it-py==2.2.0 markupsafe==2.1.5 # via # jinja2 - # moto # werkzeug mdit-py-plugins==0.3.5 # via myst-parser @@ -101,9 +97,9 @@ mdurl==0.1.2 # via markdown-it-py more-itertools==9.1.0 # via jaraco-classes -moto[codebuild,iam,s3,secretsmanager,ssm,sts]==4.0.13 +moto[codebuild,iam,s3,secretsmanager,ssm,sts]==5.0.9 # via -r requirements-dev.in -mypy==0.991 +mypy==1.10.0 # via -r requirements-dev.in mypy-extensions==1.0.0 # via mypy @@ -115,17 +111,19 @@ packaging==23.2 # pyroma # pytest # sphinx -pip-tools==6.14.0 +pip-tools==7.4.1 # via -r requirements-dev.in pkginfo==1.9.6 # via twine -pluggy==1.2.0 +pluggy==1.5.0 # via pytest +py-partiql-parser==0.5.5 + # via moto pyasn1==0.5.1 # via rsa pycparser==2.21 # via cffi -pydot==1.4.2 +pydot==2.0.0 # via -r requirements-dev.in pygments==2.17.2 # via @@ -136,18 +134,20 @@ pygments==2.17.2 pyparsing==3.1.1 # via pydot pyproject-hooks==1.0.0 - # via build + # via + # build + # pip-tools pyroma==4.2 # via -r requirements-dev.in -pytest==7.2.2 +pytest==8.2.2 # via # -r requirements-dev.in # pytest-cov # pytest-mock # pytest-ordering -pytest-cov==4.0.0 +pytest-cov==5.0.0 # via -r requirements-dev.in -pytest-mock==3.10.0 +pytest-mock==3.14.0 # via -r requirements-dev.in pytest-ordering==0.6 # via -r requirements-dev.in @@ -155,6 +155,8 @@ python-dateutil==2.8.2 # via # botocore # moto +pytz==2024.1 + # via babel pyyaml==6.0.1 # via # awscli @@ -183,14 +185,12 @@ rich==13.7.0 # via twine rsa==4.7.2 # via awscli -ruff==0.4.4 +ruff==0.4.8 # via -r requirements-dev.in s3transfer==0.8.2 # via # awscli # boto3 -secretstorage==3.3.3 - # via keyring six==1.16.0 # via # bleach @@ -219,20 +219,31 @@ sphinxcontrib-qthelp==1.0.3 # via sphinx sphinxcontrib-serializinghtml==1.1.5 # via sphinx +tomli==2.0.1 + # via + # build + # check-manifest + # coverage + # mypy + # pip-tools + # pyproject-hooks + # pytest trove-classifiers==2024.2.22 # via pyroma -twine==4.0.2 +twine==5.1.0 # via -r requirements-dev.in -types-pyyaml==6.0.12.12 +types-pyyaml==6.0.12.20240311 # via # -r requirements-dev.in # responses -types-setuptools==57.4.18 +types-setuptools==70.0.0.20240524 # via -r requirements-dev.in typing-extensions==4.7.1 # via + # astroid # mypy # myst-parser + # rich unidecode==1.3.8 # via sphinx-autoapi urllib3==1.26.18 diff --git a/seedfarmer/checksum.py b/seedfarmer/checksum.py index c8db589f..194431ac 100644 --- a/seedfarmer/checksum.py +++ b/seedfarmer/checksum.py @@ -16,7 +16,7 @@ import hashlib import os from pathlib import Path -from typing import Any, Dict, List, Optional, cast +from typing import Any, Dict, List, Optional from gitignore_parser import parse_gitignore @@ -120,9 +120,7 @@ def scandir(dirname: str) -> List[str]: files = [ f.path for f in os.scandir(dirname) - if f.is_file() - and os.path.split(f)[1] not in cast(List[str], excluded_files) - and not _evaluate_file(f.path, ignore_maps) + if f.is_file() and os.path.split(f)[1] not in excluded_files and not _evaluate_file(f.path, ignore_maps) ] all_files.extend(files) subfolders = [f.path for f in os.scandir(dirname) if f.is_dir()] diff --git a/seedfarmer/commands/_project_policy_commands.py b/seedfarmer/commands/_project_policy_commands.py index 4f74fb8e..e708eb7a 100644 --- a/seedfarmer/commands/_project_policy_commands.py +++ b/seedfarmer/commands/_project_policy_commands.py @@ -21,4 +21,4 @@ def get_default_project_policy() -> None: with open(os.path.join(CLI_ROOT, DEFAULT_PROJECT_POLICY_PATH), "rb") as f: - shutil.copyfileobj(f, sys.stdout.buffer) + shutil.copyfileobj(f, sys.stdout.buffer) # type: ignore[misc] diff --git a/seedfarmer/mgmt/deploy_utils.py b/seedfarmer/mgmt/deploy_utils.py index 11e2a055..38588b66 100644 --- a/seedfarmer/mgmt/deploy_utils.py +++ b/seedfarmer/mgmt/deploy_utils.py @@ -655,7 +655,7 @@ def _populate_groups_to_remove( skip_deploy_spec=False, ), } - destroy_group_list.append(ModulesManifest(**group_manifest)) + destroy_group_list.append(ModulesManifest(**group_manifest)) # type: ignore[arg-type] return destroy_group_list diff --git a/seedfarmer/mgmt/git_support.py b/seedfarmer/mgmt/git_support.py index e23755ac..3c68e32c 100644 --- a/seedfarmer/mgmt/git_support.py +++ b/seedfarmer/mgmt/git_support.py @@ -54,7 +54,7 @@ def clone_module_repo(git_path: str) -> Tuple[str, str, Optional[str]]: if "?" in git_path: git_path, query = git_path.split("?") query_params = parse_qs(query) - ref = query_params.get("ref", [None])[0] # type: ignore + ref = query_params.get("ref", [None])[0] if "depth" in query_params and query_params["depth"][0].isnumeric(): depth = int(query_params["depth"][0]) diff --git a/seedfarmer/mgmt/module_info.py b/seedfarmer/mgmt/module_info.py index b6bd5681..c51bb73d 100644 --- a/seedfarmer/mgmt/module_info.py +++ b/seedfarmer/mgmt/module_info.py @@ -792,7 +792,7 @@ def _fetch_helper( name: str, params_cache: Optional[Dict[str, Any]] = None, session: Optional[Session] = None ) -> Optional[Dict[str, Any]]: if params_cache: - return params_cache.get(name, None) + return params_cache.get(name, None) # type: ignore[no-any-return] else: return ssm.get_parameter_if_exists(name=name, session=session) diff --git a/seedfarmer/models/manifests/_deployment_manifest.py b/seedfarmer/models/manifests/_deployment_manifest.py index e4e2c558..e04d97f5 100644 --- a/seedfarmer/models/manifests/_deployment_manifest.py +++ b/seedfarmer/models/manifests/_deployment_manifest.py @@ -130,7 +130,7 @@ class NameGenerator(CamelModel): prefix: Union[str, ValueFromRef] suffix: Union[str, ValueFromRef] - def _get_value(self, value: Union[str, ValueFromRef]) -> str: + def _get_value(self, value: Union[str, ValueFromRef]) -> str: # type: ignore[override] if isinstance(value, str): return value elif isinstance(value, ValueFromRef): diff --git a/test/unit-test/test_cli_arg.py b/test/unit-test/test_cli_arg.py index b49c5033..b1ee781c 100644 --- a/test/unit-test/test_cli_arg.py +++ b/test/unit-test/test_cli_arg.py @@ -18,7 +18,7 @@ import mock_data.mock_manifests as mock_manifests import pytest from _test_cli_helper_functions import _test_command -from moto import mock_sts +from moto import mock_aws from seedfarmer import config from seedfarmer.__main__ import apply, bootstrap, destroy, init, metadata, projectpolicy, remove, store, version @@ -75,7 +75,7 @@ def env_file2(): @pytest.fixture(scope="function") def sts_client(aws_credentials): - with mock_sts(): + with mock_aws(): yield boto3_client(service_name="sts", session=None) diff --git a/test/unit-test/test_commands_bootstrap.py b/test/unit-test/test_commands_bootstrap.py index af3b5ea8..5c45cc8c 100644 --- a/test/unit-test/test_commands_bootstrap.py +++ b/test/unit-test/test_commands_bootstrap.py @@ -2,7 +2,7 @@ import boto3 import pytest -from moto import mock_sts +from moto import mock_aws import seedfarmer import seedfarmer.commands._bootstrap_commands as bc @@ -24,7 +24,7 @@ def aws_credentials(): @pytest.fixture(scope="function") def sts_client(aws_credentials): - with mock_sts(): + with mock_aws(): yield boto3_client(service_name="sts", session=None) diff --git a/test/unit-test/test_commands_deployment.py b/test/unit-test/test_commands_deployment.py index 682e15e6..49c03c0d 100644 --- a/test/unit-test/test_commands_deployment.py +++ b/test/unit-test/test_commands_deployment.py @@ -7,7 +7,7 @@ import mock_data.mock_manifests as mock_manifests import mock_data.mock_module_info_huge as mock_module_info_huge import pytest -from moto import mock_sts +from moto import mock_aws import seedfarmer.commands._deployment_commands as dc import seedfarmer.errors @@ -34,7 +34,7 @@ def aws_credentials(): @pytest.fixture(scope="function") def sts_client(aws_credentials): - with mock_sts(): + with mock_aws(): yield boto3_client(service_name="sts", session=None) diff --git a/test/unit-test/test_commands_module.py b/test/unit-test/test_commands_module.py index fc399a2a..b391a07c 100644 --- a/test/unit-test/test_commands_module.py +++ b/test/unit-test/test_commands_module.py @@ -3,7 +3,7 @@ import pytest import yaml -from moto import mock_sts +from moto import mock_aws import seedfarmer.commands._module_commands as mc import seedfarmer.errors @@ -27,7 +27,7 @@ def aws_credentials(): @pytest.fixture(scope="function") def sts_client(aws_credentials): - with mock_sts(): + with mock_aws(): yield boto3_client(service_name="sts", session=None) diff --git a/test/unit-test/test_commands_network_parameters.py b/test/unit-test/test_commands_network_parameters.py index 868d6c5d..0521df20 100644 --- a/test/unit-test/test_commands_network_parameters.py +++ b/test/unit-test/test_commands_network_parameters.py @@ -2,7 +2,7 @@ from typing import Any, Dict, cast import pytest -from moto import mock_sts +from moto import mock_aws import seedfarmer.commands._network_parameter_commands as npc import seedfarmer.errors @@ -24,7 +24,7 @@ def aws_credentials(): @pytest.fixture(scope="function") def sts_client(aws_credentials): - with mock_sts(): + with mock_aws(): yield boto3_client(service_name="sts", session=None) diff --git a/test/unit-test/test_commands_parameters.py b/test/unit-test/test_commands_parameters.py index ec0cbbd1..cfbd2313 100644 --- a/test/unit-test/test_commands_parameters.py +++ b/test/unit-test/test_commands_parameters.py @@ -2,7 +2,7 @@ import pydantic_core import pytest -from moto import mock_sts +from moto import mock_aws import seedfarmer.commands._parameter_commands as pc import seedfarmer.errors @@ -24,7 +24,7 @@ def aws_credentials(): @pytest.fixture(scope="function") def sts_client(aws_credentials): - with mock_sts(): + with mock_aws(): yield boto3_client(service_name="sts", session=None) diff --git a/test/unit-test/test_commands_stack.py b/test/unit-test/test_commands_stack.py index 4047e91c..87758173 100644 --- a/test/unit-test/test_commands_stack.py +++ b/test/unit-test/test_commands_stack.py @@ -2,7 +2,7 @@ import pytest import yaml -from moto import mock_sts +from moto import mock_aws import seedfarmer.commands._stack_commands as sc from seedfarmer.models.manifests import DeploymentManifest @@ -23,7 +23,7 @@ def aws_credentials(): @pytest.fixture(scope="function") def sts_client(aws_credentials): - with mock_sts(): + with mock_aws(): yield boto3_client(service_name="sts", session=None) diff --git a/test/unit-test/test_mgmt_build_info.py b/test/unit-test/test_mgmt_build_info.py index 70e8fa90..a98beb9a 100644 --- a/test/unit-test/test_mgmt_build_info.py +++ b/test/unit-test/test_mgmt_build_info.py @@ -17,7 +17,7 @@ import mock_data.mock_build_info as mock_build_info import pytest -from moto import mock_sts +from moto import mock_aws import seedfarmer.mgmt.build_info as bi from seedfarmer.services._service_utils import boto3_client @@ -39,7 +39,7 @@ def aws_credentials(): @pytest.fixture(scope="function") def sts_client(aws_credentials): - with mock_sts(): + with mock_aws(): yield boto3_client(service_name="sts", session=None) diff --git a/test/unit-test/test_mgmt_deploy_utils.py b/test/unit-test/test_mgmt_deploy_utils.py index b6bd2308..eb946d12 100644 --- a/test/unit-test/test_mgmt_deploy_utils.py +++ b/test/unit-test/test_mgmt_deploy_utils.py @@ -21,7 +21,7 @@ import mock_data.mock_manifests as mock_manifests import mock_data.mock_module_info_huge as mock_module_info_huge import pytest -from moto import mock_sts +from moto import mock_aws import seedfarmer.errors import seedfarmer.mgmt.deploy_utils as du @@ -45,7 +45,7 @@ def aws_credentials(): @pytest.fixture(scope="function") def sts_client(aws_credentials): - with mock_sts(): + with mock_aws(): yield boto3_client(service_name="sts", session=None) diff --git a/test/unit-test/test_mgmt_git_support.py b/test/unit-test/test_mgmt_git_support.py index eabed574..03fff9c9 100644 --- a/test/unit-test/test_mgmt_git_support.py +++ b/test/unit-test/test_mgmt_git_support.py @@ -16,7 +16,7 @@ import os import pytest -from moto import mock_sts +from moto import mock_aws import seedfarmer.mgmt.git_support as sf_git from seedfarmer.services._service_utils import boto3_client @@ -38,7 +38,7 @@ def aws_credentials(): @pytest.fixture(scope="function") def sts_client(aws_credentials): - with mock_sts(): + with mock_aws(): yield boto3_client(service_name="sts", session=None) diff --git a/test/unit-test/test_services.py b/test/unit-test/test_services.py index d765b140..36a61da2 100644 --- a/test/unit-test/test_services.py +++ b/test/unit-test/test_services.py @@ -13,7 +13,7 @@ import boto3 import pytest -from moto import mock_codebuild, mock_iam, mock_ssm, mock_sts +from moto import mock_aws from seedfarmer.services import _service_utils from seedfarmer.services._service_utils import boto3_client @@ -40,7 +40,7 @@ def session(aws_credentials): @pytest.fixture(scope="function") def sts_client(aws_credentials): - with mock_sts(): + with mock_aws(): yield boto3_client(service_name="sts", session=None) @@ -57,7 +57,7 @@ def session_manager(sts_client): @pytest.fixture(scope="function") def secretsmanager_client(aws_credentials, session_manager): - with mock_sts(): + with mock_aws(): yield boto3_client(service_name="secretsmanager", session=None) @@ -86,7 +86,7 @@ def test_utils_get_account_id(sts_client, mocker): @pytest.fixture(scope="function") def iam_client(aws_credentials): - with mock_iam(): + with mock_aws(): yield _service_utils.boto3_client(service_name="iam", session=None) @@ -95,7 +95,7 @@ def iam_client(aws_credentials): def test_codebuild(session) -> None: import seedfarmer.services._codebuild as codebuild - with mock_codebuild(): + with mock_aws(): codebuild.get_build_data(build_ids=["codebuild:12345"], session=session) codebuild.get_build_data(build_ids=["12345"], session=session) @@ -105,7 +105,7 @@ def test_codebuild(session) -> None: def test_iam(iam_client, session) -> None: import seedfarmer.services._iam as iam - with mock_iam(): + with mock_aws(config={"iam": {"load_aws_managed_policies": True}}): iam.create_check_iam_role( project_name="test", deployment_name="test", @@ -160,7 +160,7 @@ def test_iam(iam_client, session) -> None: def test_get_ssm_params(session) -> None: import seedfarmer.services._ssm as ssm - with mock_ssm(): + with mock_aws(): ssm.put_parameter(name="/myapp/test/", obj={"Hey": "tsting"}, session=session) ssm.does_parameter_exist(name="/myapp/test/", session=session) ssm.does_parameter_exist(name="/garbage/", session=session) @@ -174,7 +174,7 @@ def test_get_ssm_params(session) -> None: def test_put_ssm_param(session) -> None: import seedfarmer.services._ssm as ssm - with mock_ssm(): + with mock_aws(): ssm.put_parameter(name="/myapp/test/", obj={"Hey": "tsting"}, session=session) @@ -182,7 +182,7 @@ def test_put_ssm_param(session) -> None: def test_list_ssm_param(session) -> None: import seedfarmer.services._ssm as ssm - with mock_ssm(): + with mock_aws(): ssm.put_parameter(name="/myapp/test/", obj={"Hey": "testing"}, session=session) ssm.list_parameters(prefix="/myapp/test/", session=session) ssm.list_parameters_with_filter(prefix="/myapp/", contains_string="test", session=session) @@ -192,7 +192,7 @@ def test_list_ssm_param(session) -> None: def test_delete_ssm_param(session) -> None: import seedfarmer.services._ssm as ssm - with mock_ssm(): + with mock_aws(): ssm.delete_parameters(parameters=["/myapp", "/myapp/test/"], session=session) ssm.delete_parameters( parameters=[ @@ -215,7 +215,7 @@ def test_delete_ssm_param(session) -> None: def test_get_ssm_metadata(session) -> None: import seedfarmer.services._ssm as ssm - with mock_ssm(): + with mock_aws(): ssm.put_parameter(name="/myapp/test/", obj={"Hey": "testing"}, session=session) ssm.describe_parameter(name="/myapp/test/", session=session) diff --git a/test/unit-test/test_session_manager.py b/test/unit-test/test_session_manager.py index 941c82ad..c1000ab4 100644 --- a/test/unit-test/test_session_manager.py +++ b/test/unit-test/test_session_manager.py @@ -15,7 +15,7 @@ import os import pytest -from moto import mock_sts +from moto import mock_aws import seedfarmer.errors from seedfarmer.services._service_utils import boto3_client @@ -40,7 +40,7 @@ def aws_credentials(): @pytest.fixture(scope="function") def sts_client(aws_credentials): - with mock_sts(): + with mock_aws(): yield boto3_client(service_name="sts", session=None)