diff options
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/test_client/test_conditional_content_removal.py | 5 |
1 files changed, 1 insertions, 4 deletions
diff --git a/tests/test_client/test_conditional_content_removal.py b/tests/test_client/test_conditional_content_removal.py index cc5bdb69ed..644eb23a06 100644 --- a/tests/test_client/test_conditional_content_removal.py +++ b/tests/test_client/test_conditional_content_removal.py @@ -11,11 +11,8 @@ from django.test.client import conditional_content_removal # based on Python 3.3's gzip.compress def gzip_compress(data): buf = io.BytesIO() - f = gzip.GzipFile(fileobj=buf, mode='wb', compresslevel=0) - try: + with gzip.GzipFile(fileobj=buf, mode='wb', compresslevel=0) as f: f.write(data) - finally: - f.close() return buf.getvalue() |
