Skip to content

Commit 755f09f

Browse files
Merge branch 'develop' into ci-changelog-9577574922
2 parents 2032d60 + 8a43903 commit 755f09f

28 files changed

+95
-34
lines changed

noxfile.py

Lines changed: 62 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,70 @@ def build_and_run_test(session: nox.Session, folders: List, extras: Optional[str
5050
def test_with_only_required_packages(session: nox.Session):
5151
"""Tests that only depends for required libraries"""
5252
# Logger
53+
# Metrics - Amazon CloudWatch EMF
54+
# Metrics - Base provider
55+
# Middleware factory without tracer
5356
build_and_run_test(
5457
session,
5558
folders=[
56-
f"{PREFIX_TESTS_FUNCTIONAL}/logger/",
59+
f"{PREFIX_TESTS_FUNCTIONAL}/logger/required_dependencies/",
60+
f"{PREFIX_TESTS_FUNCTIONAL}/metrics/required_dependencies/",
61+
f"{PREFIX_TESTS_FUNCTIONAL}/middleware_factory/required_dependencies/",
5762
],
5863
)
64+
65+
66+
@nox.session()
67+
def test_with_datadog_as_required_package(session: nox.Session):
68+
"""Tests that depends on Datadog library"""
69+
# Metrics - Datadog
70+
build_and_run_test(
71+
session,
72+
folders=[
73+
f"{PREFIX_TESTS_FUNCTIONAL}/metrics/datadog/",
74+
],
75+
extras="datadog",
76+
)
77+
78+
79+
@nox.session()
80+
def test_with_xray_sdk_as_required_package(session: nox.Session):
81+
"""Tests that depends on AWS XRAY SDK library"""
82+
# Tracer
83+
# Middleware factory with tracer
84+
build_and_run_test(
85+
session,
86+
folders=[
87+
f"{PREFIX_TESTS_FUNCTIONAL}/tracer/_aws_xray_sdk/",
88+
f"{PREFIX_TESTS_FUNCTIONAL}/middleware_factory/_aws_xray_sdk/",
89+
],
90+
extras="tracer",
91+
)
92+
93+
94+
@nox.session()
95+
def test_with_boto3_sdk_as_required_package(session: nox.Session):
96+
"""Tests that depends on boto3/botocore library"""
97+
# Parameters
98+
# Feature Flags
99+
build_and_run_test(
100+
session,
101+
folders=[
102+
f"{PREFIX_TESTS_FUNCTIONAL}/parameters/_boto3/",
103+
f"{PREFIX_TESTS_FUNCTIONAL}/feature_flags/_boto3/",
104+
],
105+
extras="aws-sdk",
106+
)
107+
108+
109+
@nox.session()
110+
def test_with_fastjsonschema_as_required_package(session: nox.Session):
111+
"""Tests that depends on boto3/botocore library"""
112+
# Validation
113+
build_and_run_test(
114+
session,
115+
folders=[
116+
f"{PREFIX_TESTS_FUNCTIONAL}/validator/_fastjsonschema/",
117+
],
118+
extras="validation",
119+
)

tests/functional/logger/required_dependencies/__init__.py

Whitespace-only changes.

tests/functional/metrics/__init__.py

Whitespace-only changes.

tests/functional/metrics/datadog/__init__.py

Whitespace-only changes.

tests/functional/metrics/test_metrics_datadog.py renamed to tests/functional/metrics/datadog/test_metrics_datadog.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
from collections import namedtuple
44

55
import pytest
6-
from test_metrics_provider import capture_metrics_output
76

87
from aws_lambda_powertools.metrics.exceptions import MetricValueError, SchemaValidationError
98
from aws_lambda_powertools.metrics.provider.cold_start import reset_cold_start_flag
@@ -40,7 +39,7 @@ def test_datadog_write_to_log_with_env_variable(capsys, monkeypatch):
4039
# WHEN we add a metric
4140
metrics.add_metric(name="item_sold", value=1, product="latte", order="online")
4241
metrics.flush_metrics()
43-
logs = capture_metrics_output(capsys)
42+
logs = json.loads(capsys.readouterr().out.strip())
4443

4544
# THEN metrics is flushed to log
4645
logs["e"] = ""

tests/functional/metrics/required_dependencies/__init__.py

Whitespace-only changes.

tests/functional/middleware_factory/_aws_xray_sdk/__init__.py

Whitespace-only changes.
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
from aws_lambda_powertools.middleware_factory import lambda_handler_decorator
2+
3+
4+
def test_factory_explicit_tracing(monkeypatch):
5+
monkeypatch.setenv("POWERTOOLS_TRACE_DISABLED", "true")
6+
7+
@lambda_handler_decorator(trace_execution=True)
8+
def no_op(handler, event, context):
9+
ret = handler(event, context)
10+
return ret
11+
12+
@no_op
13+
def lambda_handler(evt, ctx):
14+
return True
15+
16+
lambda_handler({}, {})
17+
18+
19+
def test_factory_explicit_tracing_env_var(monkeypatch):
20+
monkeypatch.setenv("POWERTOOLS_TRACE_MIDDLEWARES", "true")
21+
monkeypatch.setenv("POWERTOOLS_TRACE_DISABLED", "true")
22+
23+
@lambda_handler_decorator
24+
def no_op(handler, event, context):
25+
ret = handler(event, context)
26+
return ret
27+
28+
@no_op
29+
def lambda_handler(evt, ctx):
30+
return True
31+
32+
lambda_handler({}, {})

tests/functional/middleware_factory/required_dependencies/__init__.py

Whitespace-only changes.

tests/functional/test_middleware_factory.py renamed to tests/functional/middleware_factory/required_dependencies/test_middleware_factory.py

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -62,37 +62,6 @@ def lambda_handler(evt, ctx):
6262
lambda_handler({}, {})
6363

6464

65-
def test_factory_explicit_tracing(monkeypatch):
66-
monkeypatch.setenv("POWERTOOLS_TRACE_DISABLED", "true")
67-
68-
@lambda_handler_decorator(trace_execution=True)
69-
def no_op(handler, event, context):
70-
ret = handler(event, context)
71-
return ret
72-
73-
@no_op
74-
def lambda_handler(evt, ctx):
75-
return True
76-
77-
lambda_handler({}, {})
78-
79-
80-
def test_factory_explicit_tracing_env_var(monkeypatch):
81-
monkeypatch.setenv("POWERTOOLS_TRACE_MIDDLEWARES", "true")
82-
monkeypatch.setenv("POWERTOOLS_TRACE_DISABLED", "true")
83-
84-
@lambda_handler_decorator
85-
def no_op(handler, event, context):
86-
ret = handler(event, context)
87-
return ret
88-
89-
@no_op
90-
def lambda_handler(evt, ctx):
91-
return True
92-
93-
lambda_handler({}, {})
94-
95-
9665
def test_factory_decorator_with_kwarg_params(capsys):
9766
@lambda_handler_decorator
9867
def log_event(handler, event, context, log_event=False):

tests/functional/parameters/__init__.py

Whitespace-only changes.

tests/functional/tracer/__init__.py

Whitespace-only changes.

tests/functional/tracer/_aws_xray_sdk/__init__.py

Whitespace-only changes.

tests/functional/validator/_fastjsonschema/__init__.py

Whitespace-only changes.

0 commit comments

Comments
 (0)