Projet

Général

Profil

0002-py3-update.patch

Benjamin Dauvergne, 31 janvier 2020 20:19

Télécharger (1,63 ko)

Voir les différences:

Subject: [PATCH 2/2] py3 update

 passerelle/utils/zip.py   | 4 ++--
 tests/test_mdel_ddpacs.py | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)
passerelle/utils/zip.py
258 258
        return 'File %s differs' % one
259 259

  
260 260
    if not hasattr(one, 'read'):
261
        one = open(one)
261
        one = open(one, mode='rb')
262 262
    with one:
263 263
        if not hasattr(two, 'read'):
264
            two = open(two)
264
            two = open(two, 'rb')
265 265
        with two:
266 266
            with zipfile.ZipFile(one) as one_zip:
267 267
                with zipfile.ZipFile(two) as two_zip:
tests/test_mdel_ddpacs.py
101 101
        resource.jobs()
102 102
        assert 'A-1-1-depotDossierPACS-1.zip' in content['output']
103 103
        # Check it's the same document than through the zip_url
104
        with open('/tmp/zip.zip', 'w') as fd:
104
        with open('/tmp/zip.zip', 'wb') as fd:
105 105
            fd.write(content['output']['A-1-1-depotDossierPACS-1.zip'])
106 106
        with io.BytesIO(content['output']['A-1-1-depotDossierPACS-1.zip']) as fd:
107 107
            differences = diff_zip('tests/data/mdel_ddpacs_expected.zip', fd)
108
-