Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build(deps-dev): bump pip group with 8 updates (moto v5) #451

Merged
merged 2 commits into from
Mar 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand All @@ -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]
Expand Down
4 changes: 2 additions & 2 deletions src/aec/util/docgen.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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,
Expand Down
24 changes: 24 additions & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
@@ -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)
Expand All @@ -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()
6 changes: 1 addition & 5 deletions tests/test_ami.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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",
}
Expand Down
8 changes: 3 additions & 5 deletions tests/test_compute_optimizer.py
Original file line number Diff line number Diff line change
@@ -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

Expand All @@ -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 {
Expand All @@ -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",
},
}
Expand Down
9 changes: 3 additions & 6 deletions tests/test_ec2.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -33,17 +33,15 @@


@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 {
"region": region,
"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",
},
}
Expand Down Expand Up @@ -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")

Expand Down
6 changes: 1 addition & 5 deletions tests/test_ssm.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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",
}
Expand Down
Loading