Development #40911
Tourner les tests aussi en python3
0%
Description
Dans l'optique de passer zoo en python3.
Associated revisions
python3: get urllib/urlparse from six (#40911)
python3: get StringIO from six (#40911)
python3: replace unicode references (#40911)
python3: encode unicode-objects before hashing (#40911)
python3: replace response content with text (#40911)
python3: pass bytes to Upload content (#40911)
python3: use text to manage csv content (#40911)
python3: take reduce from functools package (#40911)
python3: use listcomp insted of map object generator (#40911)
python3: replace .iteritems by .items (#40911)
python3: replace json string parser input by text (#40911)
python3: open report files as binary (#40911)
FileReponse wants binary streams, but csv.reader() wants text streams.
python3: open django.core.files.storage in text mode for csv (#40911)
python3: provide string representations (#40911)
python3: update tox to check against both python versions (#40911)
trivial: switch forgotten execfile() call to exec() (#40911)
History
Updated by Nicolas Roche about 3 years ago
Voici la branche : http://git.entrouvert.org/zoo.git/log/?h=wip/40911-add-python3-tests
Il y a http://git.entrouvert.org/zoo.git/commit/?h=wip/40911-add-python3-tests&id=30e4d1b388b1813e4d473ce47d550041d96f4eaf qui pour moi est mystérieux :
fileresponse prend un stream-like en premier argument après si ça boucle à mon avis le problème est ailleurs
Updated by Benjamin Dauvergne about 3 years ago
Nicolas Roche a écrit :
fileresponse prend un stream-like en premier argument après si ça boucle à mon avis le problème est ailleurs
Je regarde ça, tout le reste m'a l'air ok.
Updated by Benjamin Dauvergne about 3 years ago
- Status changed from Solution proposée to Solution validée
Benjamin Dauvergne a écrit :
Nicolas Roche a écrit :
fileresponse prend un stream-like en premier argument après si ça boucle à mon avis le problème est ailleurs
Je regarde ça, tout le reste m'a l'air ok.
J'ai fait la correction différemment, c'est poussé sur ta branche. Il fallait passer mode='rb' à default_storage.open() avec python3 (j'ai du adapté les usages de csv.reader() qui veut absolument une text-stream).
Updated by Nicolas Roche about 3 years ago
Il fallait passer mode='rb' à default_storage.open() avec python3
En fait c'était déjà le cas avant, par défaut.
C'est moi qui l'avait basculé à 'r' (pour avoir l'effet d'un 'rt') et du coup j'ai simplifié ton commit.
Par contre, j'ai du laisser une occurrence avec 'r' sur SynchronizeFederationsImport
,
for i, line in enumerate(default_storage.open(self.action.csv_filepath, 'r'):
afin de passer la partie Upload du test
test_nanterre_synchronize_federations.py::test_synchronize_federations
.(j'ai déplacé ce patch en denier)
Ça reste raisonnable d'avoir 2 modes différents (binaire/text) pour le téléchargement et l'upload ?
(sinon j'ai ajouté un .gitignore en loosdé, dites moi si je dois le dégager)
Updated by Benjamin Dauvergne about 3 years ago
Nicolas Roche a écrit :
(sinon j'ai ajouté un .gitignore en loosdé, dites moi si je dois le dégager)
Non c'est bon, go.
Updated by Nicolas Roche about 3 years ago
Encore une chose (désolé), cf #41025 :
le Jenkinsfile lance un « tox -rv -e coverage » ce qui ne lance que les tests py3
j'ai modifié en conséquence le commit relatif au tox.ini
Updated by Nicolas Roche about 3 years ago
- Status changed from Solution validée to Solution proposée
Merci !
Là tu vas me maudire : j'ai ajouté un (dernier) commit de compatibilité :
http://git.entrouvert.org/zoo.git/commit/?h=wip/40911-add-python3-tests&id=0159378fffb8926341d13205b402d1935eb531a1
C'est en écrivant les tests (#41025) que je me rend compte que les identifiants ne sont pas convertis : j'obtiens Entity object
à la place de l'id.
Updated by Benjamin Dauvergne about 3 years ago
- Status changed from Solution proposée to Solution validée
Updated by Nicolas Roche about 3 years ago
- Status changed from Solution validée to Résolu (à déployer)
commit 5677795e8ff24f8e60b4fc89db6f149588c5b17f Author: Nicolas ROCHE <nroche@entrouvert.com> Date: Mon Mar 23 15:07:15 2020 +0100 python3: update tox to check against both python versions (#40911) commit 1aca22f73e011ef4dbf6be4116c9764c8211e5fb Author: Nicolas ROCHE <nroche@entrouvert.com> Date: Thu Mar 26 16:32:03 2020 +0100 python3: provide string representations (#40911) commit a964e71e45d26f36fa6580e96585a95da2ecf097 Author: Nicolas ROCHE <nroche@entrouvert.com> Date: Wed Mar 25 11:53:13 2020 +0100 python3: open django.core.files.storage in text mode for csv (#40911) commit c20eb03a1145eb34f572920a226eff3e26b27b17 Author: Nicolas ROCHE <nroche@entrouvert.com> Date: Tue Mar 24 11:44:30 2020 +0100 python3: open report files as binary (#40911) FileReponse wants binary streams, but csv.reader() wants text streams. commit ec91ea59b1c0c6d90ca5a832caa671933626a2d9 Author: Nicolas ROCHE <nroche@entrouvert.com> Date: Tue Mar 24 12:38:37 2020 +0100 python3: replace json string parser input by text (#40911) commit e87926327788b08fbcd816f525395aa36616a3bb Author: Nicolas ROCHE <nroche@entrouvert.com> Date: Tue Mar 24 12:20:45 2020 +0100 python3: replace .iteritems by .items (#40911) commit 025fa0f2ca20960f0c7a5c7eafcbaabaf9c52c72 Author: Nicolas ROCHE <nroche@entrouvert.com> Date: Tue Mar 24 12:10:59 2020 +0100 python3: use listcomp insted of map object generator (#40911) commit 5311d34d6cc7a0211afb762e250834e088081740 Author: Nicolas ROCHE <nroche@entrouvert.com> Date: Tue Mar 24 11:53:06 2020 +0100 python3: take reduce from functools package (#40911) commit 55af5e1d5bef4347576671a7313520ec5bdcf678 Author: Nicolas ROCHE <nroche@entrouvert.com> Date: Tue Mar 24 11:40:00 2020 +0100 python3: use text to manage csv content (#40911) commit 02f660ca5bfb206b9e25bd2b93824aebef0fc39c Author: Nicolas ROCHE <nroche@entrouvert.com> Date: Tue Mar 24 11:35:02 2020 +0100 python3: pass bytes to Upload content (#40911) commit f39cbee9d2647df570b882a94226e211e9f73bed Author: Nicolas ROCHE <nroche@entrouvert.com> Date: Mon Mar 23 17:34:53 2020 +0100 python3: replace response content with text (#40911) commit dcb53519621b76ff619953176b501135ee10923e Author: Nicolas ROCHE <nroche@entrouvert.com> Date: Mon Mar 23 15:56:26 2020 +0100 python3: encode unicode-objects before hashing (#40911) commit 921a3f27e166193c350fcd146adcaea7a44dbd46 Author: Nicolas ROCHE <nroche@entrouvert.com> Date: Mon Mar 23 15:50:20 2020 +0100 python3: replace unicode references (#40911) commit a15b4cddbb43d7e2d06fd2ed523e65c550e9cd11 Author: Nicolas ROCHE <nroche@entrouvert.com> Date: Mon Mar 23 15:17:08 2020 +0100 python3: get StringIO from six (#40911) commit 46478781cf2b48338d332873288d85f7d16f6701 Author: Nicolas ROCHE <nroche@entrouvert.com> Date: Mon Mar 23 15:13:57 2020 +0100 python3: get urllib/urlparse from six (#40911) commit b3517e49dff8e69d5d320aed6e5d41574f9f86c2 Author: Nicolas ROCHE <nroche@entrouvert.com> Date: Wed Mar 25 12:00:58 2020 +0100 misc: add .gitignore (#40911)
Updated by Nicolas Roche about 3 years ago
- Status changed from Résolu (à déployer) to Solution déployée
misc: add .gitignore (#40911)