diff options
| author | Michael Williamson <mike@zwobble.org> | 2018-01-19 20:16:51 +0000 |
|---|---|---|
| committer | Michael Williamson <mike@zwobble.org> | 2018-01-19 20:16:51 +0000 |
| commit | 41000ecae3f59c8e766b83b4dfc2e67467eef00f (patch) | |
| tree | 73710a6f089c4e8fdecc5caad9a189fd080bc76b /tests/docx/docx_tests.py | |
| parent | df5644cde6ba9b70870ddb01caaee423e00e49ad (diff) | |
Fix tests on Python 2.6
Diffstat (limited to 'tests/docx/docx_tests.py')
| -rw-r--r-- | tests/docx/docx_tests.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/tests/docx/docx_tests.py b/tests/docx/docx_tests.py index fd53d4f..9f2af01 100644 --- a/tests/docx/docx_tests.py +++ b/tests/docx/docx_tests.py @@ -65,9 +65,12 @@ def when_document_xml_is_not_present_then_document_is_found_using_file_relations def _create_zip(files): fileobj = io.BytesIO() - with zipfile.ZipFile(fileobj, "w") as zip_file: + zip_file = zipfile.ZipFile(fileobj, "w") + try: for name, contents in files.items(): zip_file.writestr(name, contents) + finally: + zip_file.close() fileobj.seek(0) return fileobj |
