Skip to content

chore(ci): add the Parser feature to nox tests #4584

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

Merged
merged 1 commit into from
Jun 20, 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
6 changes: 4 additions & 2 deletions noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ def test_with_boto3_sdk_as_required_package(session: nox.Session):

@nox.session()
def test_with_fastjsonschema_as_required_package(session: nox.Session):
"""Tests that depends on boto3/botocore library"""
"""Tests that depends on fastjsonschema library"""
# Validation
build_and_run_test(
session,
Expand Down Expand Up @@ -145,14 +145,16 @@ def test_with_aws_encryption_sdk_as_required_package(session: nox.Session):
@nox.session()
@nox.parametrize("pydantic", ["1.10", "2.0"])
def test_with_pydantic_required_package(session: nox.Session, pydantic: str):
"""Tests that only depends for required libraries"""
"""Tests that only depends for Pydantic library v1 and v2"""
# Event Handler OpenAPI
# Parser

session.install(f"pydantic>={pydantic}")

build_and_run_test(
session,
folders=[
f"{PREFIX_TESTS_FUNCTIONAL}/event_handler/_pydantic/",
f"{PREFIX_TESTS_UNIT}/parser/_pydantic/",
],
)
Empty file.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from aws_lambda_powertools.utilities.parser import envelopes, parse
from aws_lambda_powertools.utilities.parser.models import APIGatewayProxyEventModel
from tests.functional.utils import load_event
from tests.unit.parser.schemas import MyApiGatewayBusiness
from tests.unit.parser._pydantic.schemas import MyApiGatewayBusiness


def test_apigw_event_with_envelope():
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
RequestContextV2Authorizer,
)
from tests.functional.utils import load_event
from tests.unit.parser.schemas import MyApiGatewayBusiness
from tests.unit.parser._pydantic.schemas import MyApiGatewayBusiness


def test_apigw_v2_event_with_envelope():
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from aws_lambda_powertools.utilities.parser import envelopes, parse
from aws_lambda_powertools.utilities.parser.models import BedrockAgentEventModel
from tests.functional.utils import load_event
from tests.unit.parser.schemas import MyBedrockAgentBusiness
from tests.unit.parser._pydantic.schemas import MyBedrockAgentBusiness


def test_bedrock_agent_event_with_envelope():
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
CloudWatchLogsModel,
)
from tests.functional.utils import load_event
from tests.unit.parser.schemas import MyCloudWatchBusiness
from tests.unit.parser._pydantic.schemas import MyCloudWatchBusiness


def decode_cloudwatch_raw_event(event: dict):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

from aws_lambda_powertools.utilities.parser import ValidationError, envelopes, parse
from tests.functional.utils import load_event
from tests.unit.parser.schemas import MyAdvancedDynamoBusiness, MyDynamoBusiness
from tests.unit.parser._pydantic.schemas import MyAdvancedDynamoBusiness, MyDynamoBusiness


def test_dynamo_db_stream_trigger_event():
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

from aws_lambda_powertools.utilities.parser import ValidationError, envelopes, parse
from tests.functional.utils import load_event
from tests.unit.parser.schemas import (
from tests.unit.parser._pydantic.schemas import (
MyAdvancedEventbridgeBusiness,
MyEventbridgeBusiness,
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
KafkaSelfManagedEventModel,
)
from tests.functional.utils import load_event
from tests.unit.parser.schemas import MyLambdaKafkaBusiness
from tests.unit.parser._pydantic.schemas import MyLambdaKafkaBusiness


def test_kafka_msk_event_with_envelope():
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
extract_cloudwatch_logs_from_record,
)
from tests.functional.utils import load_event
from tests.unit.parser.schemas import MyKinesisBusiness
from tests.unit.parser._pydantic.schemas import MyKinesisBusiness


def test_kinesis_trigger_bad_base64_event():
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
KinesisFirehoseSqsRecord,
)
from tests.functional.utils import load_event
from tests.unit.parser.schemas import MyKinesisFirehoseBusiness
from tests.unit.parser._pydantic.schemas import MyKinesisFirehoseBusiness


def test_firehose_sqs_wrapped_message_event():
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from aws_lambda_powertools.utilities.parser import envelopes, parse
from aws_lambda_powertools.utilities.parser.models import LambdaFunctionUrlModel
from tests.functional.utils import load_event
from tests.unit.parser.schemas import MyALambdaFuncUrlBusiness
from tests.unit.parser._pydantic.schemas import MyALambdaFuncUrlBusiness


def test_lambda_func_url_event_with_envelope():
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from aws_lambda_powertools.utilities.parser import ValidationError, envelopes, parse
from tests.functional.utils import load_event
from tests.functional.validator.conftest import sns_event # noqa: F401
from tests.unit.parser.schemas import MyAdvancedSnsBusiness, MySnsBusiness
from tests.unit.parser._pydantic.schemas import MyAdvancedSnsBusiness, MySnsBusiness


def test_handle_sns_trigger_event_json_body(sns_event): # noqa: F811
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from aws_lambda_powertools.utilities.parser.models import SqsModel
from tests.functional.utils import load_event
from tests.functional.validator.conftest import sqs_event # noqa: F401
from tests.unit.parser.schemas import MyAdvancedSqsBusiness, MySqsBusiness
from tests.unit.parser._pydantic.schemas import MyAdvancedSqsBusiness, MySqsBusiness


def test_handle_sqs_trigger_event_json_body(sqs_event): # noqa: F811
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from aws_lambda_powertools.utilities.parser import ValidationError, envelopes, parse
from aws_lambda_powertools.utilities.parser.models import VpcLatticeModel
from tests.functional.utils import load_event
from tests.unit.parser.schemas import MyVpcLatticeBusiness
from tests.unit.parser._pydantic.schemas import MyVpcLatticeBusiness


def test_vpc_lattice_event_with_envelope():
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from aws_lambda_powertools.utilities.parser import ValidationError, envelopes, parse
from aws_lambda_powertools.utilities.parser.models import VpcLatticeV2Model
from tests.functional.utils import load_event
from tests.unit.parser.schemas import MyVpcLatticeBusiness
from tests.unit.parser._pydantic.schemas import MyVpcLatticeBusiness


def test_vpc_lattice_v2_event_with_envelope():
Expand Down