Skip to content

Upgrade simplejson to 3.18.4 #136

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
Mar 27, 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
2 changes: 1 addition & 1 deletion requirements/base.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
simplejson==3.17.2
simplejson==3.18.4
5 changes: 3 additions & 2 deletions tests/test_bootstrap.py
Original file line number Diff line number Diff line change
Expand Up @@ -1478,18 +1478,19 @@ def test_run(self, mock_runtime_client, mock_handle_event_request):
"awslambdaric.bootstrap.LambdaLoggerHandler",
Mock(side_effect=Exception("Boom!")),
)
@patch("awslambdaric.bootstrap.build_fault_result", MagicMock())
@patch("awslambdaric.bootstrap.build_fault_result")
@patch("awslambdaric.bootstrap.log_error", MagicMock())
@patch("awslambdaric.bootstrap.LambdaRuntimeClient", MagicMock())
@patch("awslambdaric.bootstrap.sys")
def test_run_exception(self, mock_sys):
def test_run_exception(self, mock_sys, mock_build_fault_result):
class TestException(Exception):
pass

expected_app_root = "/tmp/test/app_root"
expected_handler = "app.my_test_handler"
expected_lambda_runtime_api_addr = "test_addr"

mock_build_fault_result.return_value = {}
Copy link
Contributor Author

@kpark-hrp kpark-hrp Mar 17, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to mock build_fault_result() return value because newer simplejson will throw an error when it tries to JSON encode a MagicMock type.

E           TypeError: _asdict() must return a dict, not MagicMock

error_result = build_fault_result(sys.exc_info(), None)
log_error(error_result, log_sink)
lambda_runtime_client.post_init_error(to_json(error_result))

mock_sys.exit.side_effect = TestException("Boom!")

with self.assertRaises(TestException):
Expand Down
Loading