mirror of https://github.com/zulip/zulip.git
test_delete_unclaimed_attachments: Close file in make_attachment.
Fixes “ResourceWarning: unclosed file <_io.BufferedReader name='/srv/zulip/zerver/tests/images/text.txt'>” with warnings enabled. Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
parent
325ab83edb
commit
c7281b406f
|
@ -28,10 +28,10 @@ class UnclaimedAttachmentTest(UploadSerializeMixin, ZulipTestCase):
|
||||||
self.login_user(uploader)
|
self.login_user(uploader)
|
||||||
|
|
||||||
with time_machine.travel(when, tick=False):
|
with time_machine.travel(when, tick=False):
|
||||||
file_obj = get_test_image_file(filename)
|
with get_test_image_file(filename) as file_obj:
|
||||||
response = self.assert_json_success(
|
response = self.assert_json_success(
|
||||||
self.client_post("/json/user_uploads", {"file": file_obj})
|
self.client_post("/json/user_uploads", {"file": file_obj})
|
||||||
)
|
)
|
||||||
path_id = re.sub(r"/user_uploads/", "", response["url"])
|
path_id = re.sub(r"/user_uploads/", "", response["url"])
|
||||||
return Attachment.objects.get(path_id=path_id)
|
return Attachment.objects.get(path_id=path_id)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue