Skip to content

Commit 929ff2f

Browse files
author
Michael Brewer
committed
tests(metrics): fix tests when warnings are disabled
Changes: - run 'make format' - set 'warnings.simplefilter(default)' closes #993
1 parent d2d6e34 commit 929ff2f

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

Diff for: tests/functional/test_metrics.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -496,7 +496,8 @@ def lambda_handler(evt, context):
496496
# THEN ColdStart metric and function_name and service dimension should be logged
497497
assert output["ColdStart"] == [1.0]
498498
assert output["function_name"] == "example_fn"
499-
assert output['service'] == service
499+
assert output["service"] == service
500+
500501

501502
def test_log_metrics_capture_cold_start_metric_no_service(capsys, namespace):
502503
# GIVEN Metrics is initialized without service
@@ -515,7 +516,7 @@ def lambda_handler(evt, context):
515516
# THEN ColdStart metric and function_name dimension should be logged
516517
assert output["ColdStart"] == [1.0]
517518
assert output["function_name"] == "example_fn"
518-
assert output.get('service') is None
519+
assert output.get("service") is None
519520

520521

521522
def test_emit_cold_start_metric_only_once(capsys, namespace, service, metric):
@@ -551,6 +552,7 @@ def lambda_handler(evt, context):
551552

552553
# THEN it should raise a warning instead of throwing an exception
553554
with warnings.catch_warnings(record=True) as w:
555+
warnings.simplefilter("default")
554556
lambda_handler({}, {})
555557
assert len(w) == 1
556558
assert str(w[-1].message) == "No metrics to publish, skipping"

0 commit comments

Comments
 (0)