From ccea70349e15b3b2270bc55cd9d5c2961d4c2f8b Mon Sep 17 00:00:00 2001 From: Matthew Farrellee Date: Wed, 20 Aug 2025 13:30:09 -0400 Subject: [PATCH] use None instead of locals() --- tests/integration/files/test_files.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/integration/files/test_files.py b/tests/integration/files/test_files.py index c47e47f0c..8f2965362 100644 --- a/tests/integration/files/test_files.py +++ b/tests/integration/files/test_files.py @@ -27,6 +27,8 @@ def test_openai_client_basic_operations(openai_client): test_content = b"files test content" + uploaded_file = None + try: # Upload file using OpenAI client with BytesIO(test_content) as file_buffer: @@ -70,7 +72,7 @@ def test_openai_client_basic_operations(openai_client): finally: # Cleanup in case of failure - if "uploaded_file" in locals(): # maybe create fails + if uploaded_file is not None: try: client.files.delete(uploaded_file.id) except NotFoundError: