Skip to content

Commit 737906f

Browse files
committed
Fix inconsistent test behaviour: @patch not applied
1 parent 745abed commit 737906f

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

tests/test_bootstrap.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -589,10 +589,11 @@ def raise_exception_handler(json_input, lambda_context):
589589

590590
self.assertEqual(mock_stdout.getvalue(), error_logs)
591591

592-
@patch("sys.stdout", new_callable=StringIO)
592+
# The order of patches matter. Using MagicMock resets sys.stdout to the default.
593593
@patch("importlib.import_module")
594+
@patch("sys.stdout", new_callable=StringIO)
594595
def test_handle_event_request_fault_exception_logging_syntax_error(
595-
self, mock_import_module, mock_stdout
596+
self, mock_stdout, mock_import_module
596597
):
597598
try:
598599
eval("-")

0 commit comments

Comments
 (0)