Skip to content

Commit

Permalink
changes to assert statements
Browse files Browse the repository at this point in the history
  • Loading branch information
Nithin Bodanapu committed Dec 11, 2024
1 parent 4ad3083 commit 2231fcd
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions tests/tests_integration/test_file_integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ def test_errored_file(set_upload_test: Tuple[CogniteClient, ParamTest], function
LOG_FAILURE_FILE = "integration_test_failure_log.jsonl"
NO_PERMISSION_FILE = "file_with_no_permission.txt"
FILE_REASON_MAP_KEY = "file_error_reason_map"
ERROR_RAISED_ON_FILE_READ = "No permission to read file"

current_dir = pathlib.Path(__file__).parent.resolve()
os.environ["COGNITE_FUNCTION_RUNTIME"] = functions_runtime
Expand All @@ -85,7 +86,7 @@ def test_errored_file(set_upload_test: Tuple[CogniteClient, ParamTest], function
)

def load_file_from_path() -> BinaryIO:
raise Exception("No permission to read file")
raise Exception(ERROR_RAISED_ON_FILE_READ)

# Upload a pair of actual files
assert test_parameter.external_ids is not None
Expand All @@ -106,7 +107,10 @@ def load_file_from_path() -> BinaryIO:
print(f"Failure logs: {failure_logger.failure_logs}")
print(f"Check for file: {os.path.isfile(qualified_failure_logging_path)}")

assert 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"])
Expand Down

0 comments on commit 2231fcd

Please sign in to comment.