diff --git a/awslambdaric/__init__.py b/awslambdaric/__init__.py index eba1e47..470433c 100644 --- a/awslambdaric/__init__.py +++ b/awslambdaric/__init__.py @@ -2,4 +2,4 @@ Copyright 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved. """ -__version__ = "2.0.1" +__version__ = "2.0.2" diff --git a/awslambdaric/bootstrap.py b/awslambdaric/bootstrap.py index a08c233..87bdbb6 100644 --- a/awslambdaric/bootstrap.py +++ b/awslambdaric/bootstrap.py @@ -327,7 +327,7 @@ def __init__(self, fd): self.frame_type = 0xA55A0001 .to_bytes(4, "big") def __enter__(self): - self.file = os.fdopen(self.fd, 'wb', 0) + self.file = os.fdopen(self.fd, "wb", 0) return self def __exit__(self, exc_type, exc_value, exc_tb): diff --git a/tests/test_bootstrap.py b/tests/test_bootstrap.py index 83b86ba..af88924 100644 --- a/tests/test_bootstrap.py +++ b/tests/test_bootstrap.py @@ -914,7 +914,9 @@ def test_log_error_standard_log_sink(self, mock_stdout): def test_log_error_framed_log_sink(self): with NamedTemporaryFile() as temp_file: - with bootstrap.FramedTelemetryLogSink(os.open(temp_file.name, os.O_CREAT | os.O_RDWR)) as log_sink: + with bootstrap.FramedTelemetryLogSink( + os.open(temp_file.name, os.O_CREAT | os.O_RDWR) + ) as log_sink: err_to_log = bootstrap.make_error("Error message", "ErrorType", None) bootstrap.log_error(err_to_log, log_sink) @@ -949,7 +951,9 @@ def test_log_error_indentation_standard_log_sink(self, mock_stdout): def test_log_error_indentation_framed_log_sink(self): with NamedTemporaryFile() as temp_file: - with bootstrap.FramedTelemetryLogSink(os.open(temp_file.name, os.O_CREAT | os.O_RDWR)) as log_sink: + with bootstrap.FramedTelemetryLogSink( + os.open(temp_file.name, os.O_CREAT | os.O_RDWR) + ) as log_sink: err_to_log = bootstrap.make_error( "Error message", "ErrorType", [" line1 ", " line2 ", " "] ) @@ -984,7 +988,9 @@ def test_log_error_empty_stacktrace_line_standard_log_sink(self, mock_stdout): def test_log_error_empty_stacktrace_line_framed_log_sink(self): with NamedTemporaryFile() as temp_file: - with bootstrap.FramedTelemetryLogSink(os.open(temp_file.name, os.O_CREAT | os.O_RDWR)) as log_sink: + with bootstrap.FramedTelemetryLogSink( + os.open(temp_file.name, os.O_CREAT | os.O_RDWR) + ) as log_sink: err_to_log = bootstrap.make_error( "Error message", "ErrorType", ["line1", "", "line2"] ) @@ -1082,7 +1088,9 @@ def test_create_framed_telemetry_log_sinks(self): def test_single_frame(self): with NamedTemporaryFile() as temp_file: message = "hello world\nsomething on a new line!\n" - with bootstrap.FramedTelemetryLogSink(os.open(temp_file.name, os.O_CREAT | os.O_RDWR)) as ls: + with bootstrap.FramedTelemetryLogSink( + os.open(temp_file.name, os.O_CREAT | os.O_RDWR) + ) as ls: ls.log(message) with open(temp_file.name, "rb") as f: content = f.read() @@ -1101,7 +1109,9 @@ def test_multiple_frame(self): first_message = "hello world\nsomething on a new line!" second_message = "hello again\nhere's another message\n" - with bootstrap.FramedTelemetryLogSink(os.open(temp_file.name, os.O_CREAT | os.O_RDWR)) as ls: + with bootstrap.FramedTelemetryLogSink( + os.open(temp_file.name, os.O_CREAT | os.O_RDWR) + ) as ls: ls.log(first_message) ls.log(second_message)