Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

test_delete_unclaimed_attachments: Close file in make_attachment.

Anders Kaseorgc7281b406fda
diff --git a/zerver/tests/test_delete_unclaimed_attachments.py b/zerver/tests/test_delete_unclaimed_attachments.py
index 31f6fc15eea..e0a8bebd12b 100644
--- a/zerver/tests/test_delete_unclaimed_attachments.py
+++ b/zerver/tests/test_delete_unclaimed_attachments.py
@@ -28,10 +28,10 @@ class UnclaimedAttachmentTest(UploadSerializeMixin, ZulipTestCase):
self.login_user(uploader)
with time_machine.travel(when, tick=False):
- file_obj = get_test_image_file(filename)
- response = self.assert_json_success(
- self.client_post("/json/user_uploads", {"file": file_obj})
- )
+ with get_test_image_file(filename) as file_obj:
+ response = self.assert_json_success(
+ self.client_post("/json/user_uploads", {"file": file_obj})
+ )
path_id = re.sub(r"/user_uploads/", "", response["url"])
return Attachment.objects.get(path_id=path_id)