From 5d00eb3ac4f59ca96fa0e6331b8b42ef5ade5fac Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sat, 9 Mar 2024 22:20:38 +1100 Subject: [PATCH] build(deps-dev): bump pip group with 8 updates (moto v5) (#451) Updates the requirements on [boto3](https://github.com/boto/boto3), [importlib-resources](https://github.com/python/importlib_resources), [pytz](https://github.com/stub42/pytz), [rich](https://github.com/Textualize/rich), [typing-extensions](https://github.com/python/typing_extensions), [moto[ec2]](https://github.com/getmoto/moto), [pytest](https://github.com/pytest-dev/pytest) and [twine](https://github.com/pypa/twine) to permit the latest version. Updates `boto3` from 1.34.19 to 1.34.59
Changelog

Sourced from boto3's changelog.

1.34.59

1.34.58

1.34.57

1.34.56

1.34.55

... (truncated)

Commits

Updates `importlib-resources` from 6.1.1 to 6.1.3
Changelog

Sourced from importlib-resources's changelog.

v6.1.3

No significant changes.

v6.1.2

Bugfixes

Commits

Updates `pytz` from 2023.3.post1 to 2024.1
Commits

Updates `rich` from 13.7.0 to 13.7.1
Release notes

Sourced from rich's releases.

v13.7.1

Fixes some character widths

[13.7.1] - 2023-02-28

Fixed

Changelog

Sourced from rich's changelog.

[13.7.1] - 2023-02-28

Fixed

Commits

Updates `typing-extensions` from 4.9.0 to 4.10.0
Release notes

Sourced from typing-extensions's releases.

4.10.0

Release 4.10.0 (February 25, 2024)

This feature release adds support for PEP 728 (TypedDict with extra items) and PEP 742 (TypeIs).

There are no changes since 4.10.0rc1.

4.10.0rc1

Release 4.10.0rc1 (February 17, 2024)

Changelog

Sourced from typing-extensions's changelog.

Release 4.10.0 (February 24, 2024)

This feature release adds support for PEP 728 (TypedDict with extra items) and PEP 742 (TypeIs).

There are no changes since 4.10.0rc1.

Release 4.10.0rc1 (February 17, 2024)

Commits

Updates `moto[ec2]` to 5.0.2
Changelog

Sourced from moto[ec2]'s changelog.

5.0.2

Docker Digest for 5.0.2: sha256:89cc6c764d714bf76e592a61f0c06fd142f672085e1dd3a53eb734aaeb4e14e2

General:
* Removed the `python-jose` and `sshpubkeys` dependencies in favor of
`joserfc`. This removes a transitive dependency on `ecdsa`, which
contains a open security vulnerability

New Methods: * Autoscaling: * batch_put_scheduled_update_group_action() * batch_delete_scheduled_action()

* RDS:
    * create_db_proxy()
    * describe_db_proxies()

Miscellaneous: * AWSLambda: The ImageConfig.EntryPoint of a function is now used when invoking it in a Docker container * CognitoIDP now allows public actions even if IAM auth is enabled * DynamoDB: create_table() now validates the number of KeySchema-items * EC2: modify_image_attributes() now supports all LaunchPermissions * ECS: register_task_definition() now has improved validation around memory-parameters * Glue: create_database() now supports the tags-parameter * IAM: assume_user()/create_user()/get_caller_identity() now return the correct partition for China (aws-cn) when called from a Chinese region * ResourceGroupsTagging: get_resources() now supports ELB resources * Route53: list_hosted_zones() now supports pagination * S3: put_bucket_notification_configuration() now supports EventBridge-notifications * SES now returns errors in the correct format

5.0.1

Docker Digest for 5.0.1: sha256:b6004b2e112c0ba870b2103049548abecec476edeac7a724ed9c71249358e821

New Methods:
    * SecretsManager:
        * remove_regions_from_replication()
        * replicate_secret_to_regions()

Miscellaneous: * AWSLambda: create_event_source_mapping() now supports Kinesis streams as targets * CloudFront: Removed error handling for InvalidOriginServer, as our validation was too strict * DynamoDB: batch_execute_statement() now supports for Update/Insert/Delete-statements * DynamoDB: query() now correctly handles calls where both Limit and ScanIndexForward are supplied * EC2: Now supports availability zones for eu-central-2 (Zurich) * S3: list_objects_v2() can now return more then 1000 results max (again) * S3: copy_object() now allows in-place copies when bucket versioning is enabled * SecretsManager: create_secrets() now supports the parameters AddReplicaRegions and ForceOverwriteReplicaSecret * SecretsManager: list_secrets() now supports the filters primary-region and owning-service

... (truncated)

Commits

Updates `pytest` to 8.0.2
Release notes

Sourced from pytest's releases.

8.0.2

pytest 8.0.2 (2024-02-24)

Bug Fixes

Commits

Updates `twine` to 5.0.0
Changelog

Sourced from twine's changelog.

Twine 5.0.0 (2024-02-10)

Bugfixes ^^^^^^^^

Misc ^^^^

Twine 4.0.2 (2022-11-30)

Bugfixes ^^^^^^^^

Twine 4.0.1 (2022-06-01)

Bugfixes ^^^^^^^^

Twine 4.0.0 (2022-03-31)

Features ^^^^^^^^

Bugfixes ^^^^^^^^

... (truncated)

Commits

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. [//]: # (dependabot-automerge-start) [//]: # (dependabot-automerge-end) ---
Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot show ignore conditions` will show all of the ignore conditions of the specified dependency - `@dependabot ignore major version` will close this group update PR and stop Dependabot creating any more for the specific dependency's major version (unless you unignore this specific dependency's major version or upgrade to it yourself) - `@dependabot ignore minor version` will close this group update PR and stop Dependabot creating any more for the specific dependency's minor version (unless you unignore this specific dependency's minor version or upgrade to it yourself) - `@dependabot ignore ` will close this group update PR and stop Dependabot creating any more for the specific dependency (unless you unignore this specific dependency or upgrade to it yourself) - `@dependabot unignore ` will remove all of the ignore conditions of the specified dependency - `@dependabot unignore ` will remove the ignore condition of the specified dependency and ignore conditions
--------- Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Oliver Mannion <125105+tekumara@users.noreply.github.com> --- pyproject.toml | 16 ++++++++-------- src/aec/util/docgen.py | 4 ++-- tests/conftest.py | 24 ++++++++++++++++++++++++ tests/test_ami.py | 6 +----- tests/test_compute_optimizer.py | 8 +++----- tests/test_ec2.py | 9 +++------ tests/test_ssm.py | 6 +----- 7 files changed, 42 insertions(+), 31 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 58b47af..91ce07b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -8,13 +8,13 @@ keywords = ["AWS", "EC2", "command line", "cli"] classifiers = ["License :: OSI Approved :: MIT License"] requires-python = ">=3.8" dependencies = [ - "boto3==1.34.19", - "importlib_resources==6.1.1", + "boto3==1.34.59", + "importlib_resources==6.1.3", "pytoml==0.1.21", - "pytz==2023.3.post1", + "pytz==2024.1", "requests==2.31.0", - "rich==13.7.0", - "typing_extensions==4.9.0", + "rich==13.7.1", + "typing_extensions==4.10.0", ] [project.optional-dependencies] @@ -23,12 +23,12 @@ dev = [ "boto3-stubs[ec2,compute-optimizer,ssm,s3]", "cogapp~=3.3", "dirty-equals~=0.6", - "moto[ec2]~=4.2.13", + "moto[ec2]~=5.0.2", "pre-commit~=3.5", "pyfakefs~=5.1", - "pytest~=7.4", + "pytest~=8.0", "pytest-mock~=3.11", - "twine~=4.0", + "twine~=5.0", ] [project.scripts] diff --git a/src/aec/util/docgen.py b/src/aec/util/docgen.py index 037a8d7..8b24249 100644 --- a/src/aec/util/docgen.py +++ b/src/aec/util/docgen.py @@ -4,7 +4,7 @@ from contextlib import redirect_stdout from typing import Any, Iterator -from moto import mock_ec2 +from moto import mock_aws from moto.ec2.models import ec2_backends from moto.ec2.models.amis import AMIS @@ -13,7 +13,7 @@ from aec.util.config import Config # fixtures -mock_ec2().start() +mock_aws().start() region = "us-east-1" mock_aws_config: Config = { "region": region, diff --git a/tests/conftest.py b/tests/conftest.py index fbba781..acbc399 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -1,6 +1,10 @@ import os import pytest +from moto import mock_aws +from moto.core.models import DEFAULT_ACCOUNT_ID +from moto.ec2.models import ec2_backends +from moto.ssm.models import ssm_backends @pytest.fixture(scope="session", autouse=True) @@ -11,3 +15,23 @@ def aws_credentials(): # RuntimeError: Credentials were refreshed, but the refreshed credentials are still expired. if "AWS_CREDENTIAL_EXPIRATION" in os.environ: del os.environ["AWS_CREDENTIAL_EXPIRATION"] + + +@pytest.fixture(scope="session") +def _mock_aws(): + with mock_aws(): + yield + + +@pytest.fixture +def _mock_ec2(_mock_aws: None): + yield + # reset just the ec2 backend because its quicker than resetting all backends + ec2_backends[DEFAULT_ACCOUNT_ID].reset() + + +@pytest.fixture +def _mock_ssm(_mock_aws: None): + yield + # reset just the ssm backend because its quicker than resetting all backends + ssm_backends[DEFAULT_ACCOUNT_ID].reset() diff --git a/tests/test_ami.py b/tests/test_ami.py index 363a450..e5ad83d 100644 --- a/tests/test_ami.py +++ b/tests/test_ami.py @@ -2,7 +2,6 @@ import boto3 import pytest -from moto import mock_ec2 from moto.ec2.models.amis import AMIS from mypy_boto3_ec2 import EC2Client from mypy_boto3_ec2.type_defs import TagTypeDef @@ -12,10 +11,7 @@ @pytest.fixture -def mock_aws_config() -> Config: - mock = mock_ec2() - mock.start() - +def mock_aws_config(_mock_ec2: None) -> Config: return { "region": "ap-southeast-2", } diff --git a/tests/test_compute_optimizer.py b/tests/test_compute_optimizer.py index 13847ff..ae24bc1 100644 --- a/tests/test_compute_optimizer.py +++ b/tests/test_compute_optimizer.py @@ -1,5 +1,5 @@ import pytest -from moto import mock_ec2 +from moto.core.models import DEFAULT_ACCOUNT_ID from moto.ec2.models import ec2_backends from moto.ec2.models.amis import AMIS @@ -9,9 +9,7 @@ @pytest.fixture -def mock_aws_config(): - mock = mock_ec2() - mock.start() +def mock_aws_config(_mock_ec2: None) -> Config: region = "us-east-1" return { @@ -20,7 +18,7 @@ def mock_aws_config(): "key_name": "test_key", "vpc": { "name": "test vpc", - "subnet": ec2_backends["123456789012"]["us-east-1"].get_default_subnet("us-east-1a").id, + "subnet": ec2_backends[DEFAULT_ACCOUNT_ID][region].get_default_subnet("us-east-1a").id, "security_group": "default", }, } diff --git a/tests/test_ec2.py b/tests/test_ec2.py index 9e650be..c316434 100644 --- a/tests/test_ec2.py +++ b/tests/test_ec2.py @@ -6,7 +6,7 @@ import boto3 import pytest from dirty_equals import IsDatetime -from moto import mock_ec2, mock_iam +from moto.core.models import DEFAULT_ACCOUNT_ID from moto.ec2.models import ec2_backends from moto.ec2.models.amis import AMIS from mypy_boto3_ec2.type_defs import TagTypeDef @@ -33,9 +33,7 @@ @pytest.fixture -def mock_aws_config() -> Config: - mock = mock_ec2() - mock.start() +def mock_aws_config(_mock_ec2: None) -> Config: region = "us-east-1" return { @@ -43,7 +41,7 @@ def mock_aws_config() -> Config: "key_name": "test_key", "vpc": { "name": "test vpc", - "subnet": ec2_backends["123456789012"]["us-east-1"].get_default_subnet("us-east-1a").id, + "subnet": ec2_backends[DEFAULT_ACCOUNT_ID][region].get_default_subnet("us-east-1a").id, "security_group": "default", }, } @@ -96,7 +94,6 @@ def test_launch_multiple_security_groups(mock_aws_config: Config): print(launch(mock_aws_config, "alice", ami_id)) -@mock_iam def test_launch_with_instance_profile(mock_aws_config: Config): iam = boto3.client("iam", "us-east-1") diff --git a/tests/test_ssm.py b/tests/test_ssm.py index 65b4f8c..def1456 100644 --- a/tests/test_ssm.py +++ b/tests/test_ssm.py @@ -4,7 +4,6 @@ import boto3 import pytest -from moto import mock_ec2, mock_ssm from moto.ec2.models.amis import AMIS from mypy_boto3_ec2 import EC2Client from pytest import MonkeyPatch @@ -17,10 +16,7 @@ @pytest.fixture -def mock_aws_config(): - mock_ec2().start() - mock_ssm().start() - +def mock_aws_config(_mock_ec2: None, _mock_ssm: None): return { "region": "ap-southeast-2", }