From afedfedb4669e8f4ab1677bdb71bb9895fb2dc13 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Fri, 2 Jan 2015 13:14:31 -0500 Subject: Open zip file in context --- setuptools/tests/test_upload_docs.py | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'setuptools/tests/test_upload_docs.py') diff --git a/setuptools/tests/test_upload_docs.py b/setuptools/tests/test_upload_docs.py index ea5c3587..85f6d864 100644 --- a/setuptools/tests/test_upload_docs.py +++ b/setuptools/tests/test_upload_docs.py @@ -54,8 +54,5 @@ class TestUploadDocsTest: assert zipfile.is_zipfile(tmp_file) - zip_file = zipfile.ZipFile(tmp_file) - - assert zip_file.namelist() == ['index.html'] - - zip_file.close() + with zipfile.ZipFile(tmp_file) as zip_file: + assert zip_file.namelist() == ['index.html'] -- cgit v1.2.1