Skip to content

Commit 2a4e1ec

Browse files
refactor(e2e-tests): use standard collections for types + refactor code (#6505)
* Using generics types + enabling ruff * Using generics types + enabling ruff
1 parent ef84244 commit 2a4e1ec

File tree

79 files changed

+281
-77
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

79 files changed

+281
-77
lines changed

tests/e2e/conftest.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,18 @@
1+
from __future__ import annotations
2+
3+
from typing import TYPE_CHECKING, Any
4+
15
import pytest
26

37
from tests.e2e.utils.infrastructure import call_once
48
from tests.e2e.utils.lambda_layer.powertools_layer import LocalLambdaPowertoolsLayer
59

10+
if TYPE_CHECKING:
11+
from collections.abc import Generator
12+
613

714
@pytest.fixture(scope="session", autouse=True)
8-
def lambda_layer_build(tmp_path_factory: pytest.TempPathFactory, worker_id: str) -> str:
15+
def lambda_layer_build(tmp_path_factory: pytest.TempPathFactory, worker_id: str) -> Generator[Any, Any, Any]:
916
"""Build Lambda Layer once before stacks are created
1017
1118
Parameters

tests/e2e/data_masking/conftest.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
from __future__ import annotations
2+
13
import pytest
24

35
from tests.e2e.data_masking.infrastructure import DataMaskingStack

tests/e2e/data_masking/handlers/basic_handler.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
from __future__ import annotations
2+
13
from aws_lambda_powertools import Logger
24
from aws_lambda_powertools.utilities.data_masking import DataMasking
35
from aws_lambda_powertools.utilities.data_masking.provider.kms.aws_encryption_sdk import AWSEncryptionSDKProvider
@@ -17,7 +19,4 @@ def lambda_handler(event, context):
1719
data_masker = DataMasking(provider=AWSEncryptionSDKProvider(keys=[kms_key]))
1820
value = [1, 2, "string", 4.5]
1921
encrypted_data = data_masker.encrypt(value)
20-
response = {}
21-
response["encrypted_data"] = encrypted_data
22-
23-
return response
22+
return {"encrypted_data": encrypted_data}

tests/e2e/data_masking/infrastructure.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
from __future__ import annotations
2+
13
import aws_cdk.aws_kms as kms
24
from aws_cdk import CfnOutput, Duration
35
from aws_cdk import aws_iam as iam

tests/e2e/data_masking/test_e2e_data_masking.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
from __future__ import annotations
2+
13
import json
24
from uuid import uuid4
35

tests/e2e/event_handler/conftest.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
from __future__ import annotations
2+
13
import pytest
24

35
from tests.e2e.event_handler.infrastructure import EventHandlerStack

tests/e2e/event_handler/handlers/alb_handler.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
from __future__ import annotations
2+
13
from aws_lambda_powertools.event_handler import (
24
ALBResolver,
35
CORSConfig,

tests/e2e/event_handler/handlers/alb_handler_with_body_none.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
from __future__ import annotations
2+
13
from aws_lambda_powertools.event_handler import (
24
ALBResolver,
35
Response,

tests/e2e/event_handler/handlers/api_gateway_http_handler.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
from __future__ import annotations
2+
13
from aws_lambda_powertools.event_handler import (
24
APIGatewayHttpResolver,
35
CORSConfig,

tests/e2e/event_handler/handlers/api_gateway_rest_handler.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
from __future__ import annotations
2+
13
from aws_lambda_powertools.event_handler import (
24
APIGatewayRestResolver,
35
CORSConfig,

0 commit comments

Comments
 (0)