diff --git a/tests/apiv2/dfiq.py b/tests/apiv2/dfiq.py index cadfa4189..6a10d7c7a 100644 --- a/tests/apiv2/dfiq.py +++ b/tests/apiv2/dfiq.py @@ -478,11 +478,11 @@ def test_standalone_question_creation(self): self.assertEqual(data["parent_ids"], []) def test_upload_dfiq_archive(self): - zip_archive = open("tests/dfiq_test_data/dfiq_test_data.zip", "rb") - response = client.post( - "/api/v2/dfiq/from_archive", - files={"archive": ("test_archive.zip", zip_archive, "application/zip")}, - ) + with open("tests/dfiq_test_data/dfiq_test_data.zip", "rb") as zip_archive: + response = client.post( + "/api/v2/dfiq/from_archive", + files={"archive": ("test_archive.zip", zip_archive, "application/zip")}, + ) data = response.json() self.assertEqual(response.status_code, 200, data) self.assertEqual(data, {"total_added": 3})