From af3cf4e59916c39e1d6dadf126678b5ab19b8d36 Mon Sep 17 00:00:00 2001 From: Stephen Shen Date: Thu, 23 Jul 2026 18:22:42 -0400 Subject: [PATCH] explicitly close file --- tests/apimatic_core/utility_tests/test_api_helper.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tests/apimatic_core/utility_tests/test_api_helper.py b/tests/apimatic_core/utility_tests/test_api_helper.py index 1886139..2ea7559 100644 --- a/tests/apimatic_core/utility_tests/test_api_helper.py +++ b/tests/apimatic_core/utility_tests/test_api_helper.py @@ -826,7 +826,11 @@ def test_date_time_response_body(self, input_http_response, input_date_time_form ('I am not a file', False) ]) def test_is_file_wrapper_instance(self, input_file_wrapper, is_file_instance): - assert ApiHelper.is_file_wrapper_instance(input_file_wrapper) == is_file_instance + try: + assert ApiHelper.is_file_wrapper_instance(input_file_wrapper) == is_file_instance + finally: + if is_file_instance: + input_file_wrapper.file_stream.close() @pytest.mark.parametrize(' input_date, output_date', [ (datetime(1994, 2, 13, 5, 30, 15), Base.get_http_datetime(datetime(1994, 2, 13, 5, 30, 15))),