Skip to content

Commit 0b4d9c0

Browse files
committed
Merge branch 'mr/trespeuch/ruff' into 'master'
Remove deprecated Py38Function See merge request it/e3-aws!140
2 parents 91afdef + 9747538 commit 0b4d9c0

4 files changed

Lines changed: 14 additions & 90 deletions

File tree

src/e3/aws/troposphere/awslambda/__init__.py

Lines changed: 0 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -926,55 +926,6 @@ def show(self, stack: Stack) -> None:
926926
print("No files")
927927

928928

929-
class Py38Function(PyFunction):
930-
"""Lambda using the Python 3.8 runtime."""
931-
932-
def __init__(
933-
self,
934-
name: str,
935-
description: str,
936-
role: str | GetAtt | Role,
937-
code_dir: str | Path,
938-
handler: str,
939-
version: int | Version | AutoVersion | None = None,
940-
min_version: int | None = None,
941-
alias: str | Alias | BlueGreenAliases | None = None,
942-
requirement_file: str | Path | None = None,
943-
code_version: int | None = None,
944-
timeout: int = 3,
945-
memory_size: int | None = None,
946-
ephemeral_storage_size: int | None = None,
947-
logs_retention_in_days: int | None = None,
948-
reserved_concurrent_executions: int | None = None,
949-
logging_config: awslambda.LoggingConfig | None = None,
950-
dl_config: awslambda.DeadLetterConfig | None = None,
951-
) -> None:
952-
"""Initialize an AWS lambda function using Python 3.8 runtime.
953-
954-
See PyFunction for params description.
955-
"""
956-
super().__init__(
957-
name=name,
958-
description=description,
959-
role=role,
960-
code_dir=code_dir,
961-
handler=handler,
962-
version=version,
963-
min_version=min_version,
964-
alias=alias,
965-
requirement_file=requirement_file,
966-
code_version=code_version,
967-
timeout=timeout,
968-
runtime="python3.8",
969-
memory_size=memory_size,
970-
ephemeral_storage_size=ephemeral_storage_size,
971-
logs_retention_in_days=logs_retention_in_days,
972-
reserved_concurrent_executions=reserved_concurrent_executions,
973-
logging_config=logging_config,
974-
dl_config=dl_config,
975-
)
976-
977-
978929
class Alias(Construct):
979930
"""A lambda alias."""
980931

tests/tests_e3_aws/troposphere/awslambda/awslambda_test.py

Lines changed: 0 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@
2929
BlueGreenAliases,
3030
BlueGreenVersions,
3131
Function,
32-
Py38Function,
3332
PyFunction,
3433
Version,
3534
)
@@ -71,28 +70,6 @@
7170
},
7271
}
7372

74-
EXPECTED_PY38FUNCTION_TEMPLATE = EXPECTED_STACK_TEMPLATE | {
75-
"Resources": {
76-
"Mypylambda": {
77-
"Properties": {
78-
"Code": {
79-
"S3Bucket": "cfn_bucket",
80-
"S3Key": {
81-
"Fn::Sub": "assets/${MypylambdaSourcesS3Key}",
82-
},
83-
},
84-
"Description": "this is a test",
85-
"FunctionName": "mypylambda",
86-
"Handler": "app.main",
87-
"Role": "somearn",
88-
"Runtime": "python3.8",
89-
"Timeout": 3,
90-
},
91-
"Type": "AWS::Lambda::Function",
92-
}
93-
}
94-
}
95-
9673
EXPECTED_PYFUNCTION_DEFAULT_TEMPLATE = EXPECTED_STACK_TEMPLATE | {
9774
"Resources": {
9875
"Mypylambda": {
@@ -565,20 +542,6 @@ def simple_lambda_function() -> PyFunction:
565542
)
566543

567544

568-
def test_py38function(stack: Stack) -> None:
569-
"""Test Py38Function creation."""
570-
stack.add(
571-
Py38Function(
572-
name="mypylambda",
573-
description="this is a test",
574-
role="somearn",
575-
code_dir="my_code_dir",
576-
handler="app.main",
577-
)
578-
)
579-
assert stack.export() == EXPECTED_PY38FUNCTION_TEMPLATE
580-
581-
582545
def test_pyfunction_default(stack: Stack) -> None:
583546
"""Test PyFunction creation with default settings."""
584547
stack.add(

tests/tests_e3_aws/troposphere/s3/bucket.json

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,20 @@
2525
"Description": "this is a test",
2626
"Role": "somearn",
2727
"FunctionName": "mypylambda",
28-
"Runtime": "python3.8",
28+
"Runtime": "python3.9",
2929
"Handler": "app.main"
3030
},
3131
"Type": "AWS::Lambda::Function"
3232
},
33+
"MypylambdaLogGroup": {
34+
"DeletionPolicy": "Retain",
35+
"Properties": {
36+
"LogGroupName": "/aws/lambda/mypylambda",
37+
"RetentionInDays": 731
38+
},
39+
"Type": "AWS::Logs::LogGroup",
40+
"UpdateReplacePolicy": "Retain"
41+
},
3342
"TestBucket": {
3443
"DeletionPolicy": "Retain",
3544
"Properties": {
@@ -196,4 +205,4 @@
196205
},
197206
"Type": "AWS::SQS::QueuePolicy"
198207
}
199-
}
208+
}

tests/tests_e3_aws/troposphere/s3/s3_test.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
import pytest
77

88
from e3.aws.troposphere import Stack
9-
from e3.aws.troposphere.awslambda import Py38Function
9+
from e3.aws.troposphere.awslambda import PyFunction
1010
from e3.aws.troposphere.iam.policy_document import PolicyDocument
1111
from e3.aws.troposphere.iam.policy_statement import Trust
1212
from e3.aws.troposphere.s3 import BucketWithRoles
@@ -24,10 +24,11 @@ def test_bucket(stack: Stack) -> None:
2424

2525
topic_test = Topic(name="test-topic")
2626
queue_test = Queue(name="test-queue")
27-
lambda_test = Py38Function(
27+
lambda_test = PyFunction(
2828
name="mypylambda",
2929
description="this is a test",
3030
role="somearn",
31+
runtime="python3.9",
3132
code_dir="my_code_dir",
3233
handler="app.main",
3334
)

0 commit comments

Comments
 (0)