-
Notifications
You must be signed in to change notification settings - Fork 5
Closed
Description
What were you trying to accomplish?
I'm trying to use the logger in a lambda function that is executed once we deploy it via Terraform. We pass some custom arguments, however, the decorator is not able to handle them.
Expected Behavior
The expected behaviour should be the decorator to shallow the extra arguments
Current Behavior
Lambda function is falling with the error TypeError: decorate() got an unexpected keyword argument 'argument_name'
Possible Solution
By appending variadic arguments to decorate function, ti should fix the problem.
Steps to Reproduce (for bugs)
It's similar to that error.
Environment
- Powertools version used: 1.22.0
- Packaging format (Layers, PyPi):
- AWS Lambda function runtime:
- Debugging logs
I caught it during testing, below is the exact error
===================================================================== FAILURES ======================================================================
__________________________________________________________ test_migration_handler_failure ___________________________________________________________
monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0x11167cf90>
lambda_context = lambda_context.<locals>.LambdaContext(function_name='test', memory_limit_in_mb=128, invoked_function_arn='arn:aws:lambda:eu-west-1:809313241:function:test', aws_request_id='52fdfc07-2182-154f-163f-5f0f9a621d72')
def test_migration_handler_failure(monkeypatch, lambda_context):
mock_err_message = "Testing for failure"
def _err_side_effect(*args):
raise TypeError("Testing for failure")
mock_command = MagicMock()
mock_command.upgrade.side_effect = _err_side_effect
monkeypatch.setattr("lambdas.database_migration.handlers.command", mock_command)
mock_event = {}
> result = migration_handler(mock_event, lambda_context, num_retries=3, timeout=0.5)
E TypeError: decorate() got an unexpected keyword argument 'num_retries'
tests/database_migration/test_handler.py:37: TypeError
------- generated xml file: /Users/vspallas/Documents/Development/project/python_unit_tests_junit_report.xml -------
============================================================== short test summary info ==============================================================
FAILED tests/database_migration/test_handler.py::test_migration_handler_failure - TypeError: decorate() got an unexpected keyword argument 'num_re...
============================================================ 1 failed, 1 passed in 0.35s ============================================================
dmakarenko and heitorlessa
Metadata
Metadata
Assignees
Labels
No labels