Skip to content

Commit e2e7e9c

Browse files
committed
Fix a ResourceWarning: unclosed file
Signed-off-by: tdruez <[email protected]>
1 parent b436462 commit e2e7e9c

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

scanpipe/tests/test_api.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -665,6 +665,9 @@ def test_scanpipe_api_project_action_results_download_output_formats(self):
665665
"application/octet-stream",
666666
]
667667
self.assertIn(response["Content-Type"], expected)
668+
# Forces Django to finish the response and close the file
669+
# to prevent a "ResourceWarning: unclosed file"
670+
self.assertTrue(response.getvalue().startswith(b"PK"))
668671

669672
def test_scanpipe_api_project_action_pipelines(self):
670673
url = reverse("project-pipelines")

0 commit comments

Comments
 (0)