diff options
| author | Ville Skyttä <ville.skytta@iki.fi> | 2016-08-05 02:45:14 +0300 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2016-08-04 19:45:14 -0400 |
| commit | a2fb2b3a1feee512131c76e9040232faf2362526 (patch) | |
| tree | aef371904eb7c1710fb717c3a6bf77b3da44ee94 /tests/test_client/test_conditional_content_removal.py | |
| parent | 50e299dbfbbfd796e63e7e13b4566cf69d2c4acb (diff) | |
Fixed #27020 -- Used a context manager to close files.
Diffstat (limited to 'tests/test_client/test_conditional_content_removal.py')
| -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() |
