Description
Current behaviour
I followed the instructions in the README and installed the dependencies in a virtual environment
pip install -r hello_world/requirements.txt && pip install -r requirements-dev.txt
Then I run the tests with : POWERTOOLS_TRACE_DISABLED=1 python -m pytest
.
The test fails with output:
FAILED tests/unit/test_handler.py::test_lambda_handler - aws_lambda_powertools.metrics.exceptions.SchemaValidationError: Invalid format. Error: data._aws.CloudWatchMetrics[0].Namespace must be string, Invalid item: data._aws.CloudWatchMetrics[0...
( I can provide a full stacktrace if necessary)
Potential solution
I looked into base.py
of the aws_lambda_powertools
metrics
package and found that it is looking for an env var POWERTOOLS_METRICS_NAMESPACE
.
This env var is not there when running the tests.
First setting the env var and then running it solves the issue:
POWERTOOLS_TRACE_DISABLED=1 POWERTOOLS_METRICS_NAMESPACE=test python -m pytest tests -v
If my assessment is correct, I propose to update the README. If incorrect can you help me by determining what is causing this problem?
Activity