Skip to content

Commit aa0a8b8

Browse files
committed
Update tests.
1 parent e0e66ee commit aa0a8b8

File tree

1 file changed

+24
-8
lines changed

1 file changed

+24
-8
lines changed

tests/test_bootstrap.py

Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@
2020
from awslambdaric.lambda_runtime_exception import FaultException
2121
from awslambdaric.lambda_runtime_log_utils import LogFormat, _get_log_level_from_env_var
2222
from awslambdaric.lambda_runtime_marshaller import LambdaMarshaller
23+
from awslambdaric.lambda_literals import (
24+
lambda_unhandled_exception_warning_message,
25+
)
2326

2427

2528
class TestUpdateXrayEnv(unittest.TestCase):
@@ -461,7 +464,10 @@ def raise_exception_handler(json_input, lambda_context):
461464
)
462465

463466
# NOTE: Indentation characters are NO-BREAK SPACE (U+00A0) not SPACE (U+0020)
464-
error_logs = "[ERROR] FaultExceptionType: Fault exception msg\r"
467+
error_logs = (
468+
lambda_unhandled_exception_warning_message
469+
+ "[ERROR] FaultExceptionType: Fault exception msg\r"
470+
)
465471
error_logs += "Traceback (most recent call last):\r"
466472
error_logs += '  File "spam.py", line 3, in <module>\r'
467473
error_logs += "    spam.eggs()\r"
@@ -492,7 +498,10 @@ def raise_exception_handler(json_input, lambda_context):
492498
0,
493499
bootstrap.StandardLogSink(),
494500
)
495-
error_logs = "[ERROR] FaultExceptionType: Fault exception msg\rTraceback (most recent call last):\n"
501+
error_logs = (
502+
lambda_unhandled_exception_warning_message
503+
+ "[ERROR] FaultExceptionType: Fault exception msg\rTraceback (most recent call last):\n"
504+
)
496505

497506
self.assertEqual(mock_stdout.getvalue(), error_logs)
498507

@@ -518,7 +527,10 @@ def raise_exception_handler(json_input, lambda_context):
518527
0,
519528
bootstrap.StandardLogSink(),
520529
)
521-
error_logs = "[ERROR] FaultExceptionType\rTraceback (most recent call last):\n"
530+
error_logs = (
531+
lambda_unhandled_exception_warning_message
532+
+ "[ERROR] FaultExceptionType\rTraceback (most recent call last):\n"
533+
)
522534

523535
self.assertEqual(mock_stdout.getvalue(), error_logs)
524536

@@ -544,7 +556,10 @@ def raise_exception_handler(json_input, lambda_context):
544556
0,
545557
bootstrap.StandardLogSink(),
546558
)
547-
error_logs = "[ERROR] Fault exception msg\rTraceback (most recent call last):\n"
559+
error_logs = (
560+
lambda_unhandled_exception_warning_message
561+
+ "[ERROR] Fault exception msg\rTraceback (most recent call last):\n"
562+
)
548563

549564
self.assertEqual(mock_stdout.getvalue(), error_logs)
550565

@@ -579,8 +594,7 @@ def raise_exception_handler(json_input, lambda_context):
579594
0,
580595
bootstrap.StandardLogSink(),
581596
)
582-
583-
error_logs = "[ERROR]\r"
597+
error_logs = lambda_unhandled_exception_warning_message + "[ERROR]\r"
584598
error_logs += "Traceback (most recent call last):\r"
585599
error_logs += '  File "spam.py", line 3, in <module>\r'
586600
error_logs += "    spam.eggs()\r"
@@ -615,8 +629,10 @@ def test_handle_event_request_fault_exception_logging_syntax_error(
615629
0,
616630
bootstrap.StandardLogSink(),
617631
)
618-
619-
error_logs = f"[ERROR] Runtime.UserCodeSyntaxError: Syntax error in module 'a': {syntax_error}\r"
632+
error_logs = (
633+
lambda_unhandled_exception_warning_message
634+
+ f"[ERROR] Runtime.UserCodeSyntaxError: Syntax error in module 'a': {syntax_error}\r"
635+
)
620636
error_logs += "Traceback (most recent call last):\r"
621637
error_logs += '  File "<string>" Line 1\r'
622638
error_logs += "    -\n"

0 commit comments

Comments
 (0)