From 16f79e7c67c1b0a987d15ed05da02293b4f3f1fe Mon Sep 17 00:00:00 2001 From: Nithin Bodanapu Date: Thu, 12 Dec 2024 03:55:23 +0530 Subject: [PATCH] Handle the exception in upload queue and check for value in failure logger --- .../test_file_integration.py | 25 ++++++++++--------- 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/tests/tests_integration/test_file_integration.py b/tests/tests_integration/test_file_integration.py index c99b2bd..704cc1c 100644 --- a/tests/tests_integration/test_file_integration.py +++ b/tests/tests_integration/test_file_integration.py @@ -99,18 +99,19 @@ def load_file_from_path() -> BinaryIO: read_file=load_file_from_path, ) - queue.upload() - - time.sleep(5) - - failure_logger = queue.get_failure_logger() - print(f"Failure logs: {failure_logger.failure_logs}") - print(f"Check for file: {os.path.isfile(qualified_failure_logging_path)}") - - assert len(failure_logger) == 1 - assert FILE_REASON_MAP_KEY in failure_logger - assert NO_PERMISSION_FILE in failure_logger[FILE_REASON_MAP_KEY] - assert ERROR_RAISED_ON_FILE_READ in failure_logger[FILE_REASON_MAP_KEY][NO_PERMISSION_FILE] + try: + queue.upload() + + time.sleep(5) + except Exception as e: + failure_logger = queue.get_failure_logger() + print(f"Failure logs: {failure_logger.failure_logs}") + print(f"Check for file: {os.path.isfile(qualified_failure_logging_path)}") + + assert len(failure_logger) == 1 + assert FILE_REASON_MAP_KEY in failure_logger + assert NO_PERMISSION_FILE in failure_logger[FILE_REASON_MAP_KEY] + assert ERROR_RAISED_ON_FILE_READ in failure_logger[FILE_REASON_MAP_KEY][NO_PERMISSION_FILE] @pytest.mark.parametrize("functions_runtime", ["true", "false"])