From 8f92434dee3c1e8fe66af75a90557bcfe9bdb3e3 Mon Sep 17 00:00:00 2001 From: Benjamin Dauvergne Date: Fri, 31 Jan 2020 20:18:57 +0100 Subject: [PATCH 2/2] py3 update --- passerelle/utils/zip.py | 4 ++-- tests/test_mdel_ddpacs.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/passerelle/utils/zip.py b/passerelle/utils/zip.py index c6b99697..8950dc78 100644 --- a/passerelle/utils/zip.py +++ b/passerelle/utils/zip.py @@ -258,10 +258,10 @@ def diff_zip(one, two): return 'File %s differs' % one if not hasattr(one, 'read'): - one = open(one) + one = open(one, mode='rb') with one: if not hasattr(two, 'read'): - two = open(two) + two = open(two, 'rb') with two: with zipfile.ZipFile(one) as one_zip: with zipfile.ZipFile(two) as two_zip: diff --git a/tests/test_mdel_ddpacs.py b/tests/test_mdel_ddpacs.py index 4350815b..cc6812fd 100644 --- a/tests/test_mdel_ddpacs.py +++ b/tests/test_mdel_ddpacs.py @@ -101,7 +101,7 @@ def test_create_demand(app, resource, ddpacs_payload, freezer, sftpserver, caplo resource.jobs() assert 'A-1-1-depotDossierPACS-1.zip' in content['output'] # Check it's the same document than through the zip_url - with open('/tmp/zip.zip', 'w') as fd: + with open('/tmp/zip.zip', 'wb') as fd: fd.write(content['output']['A-1-1-depotDossierPACS-1.zip']) with io.BytesIO(content['output']['A-1-1-depotDossierPACS-1.zip']) as fd: differences = diff_zip('tests/data/mdel_ddpacs_expected.zip', fd) -- 2.24.0