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))),