Projet

Général

Profil

Development #40911

Tourner les tests aussi en python3

Ajouté par Nicolas Roche il y a environ 4 ans. Mis à jour il y a environ 4 ans.

Statut:
Fermé
Priorité:
Normal
Assigné à:
Version cible:
-
Début:
23 mars 2020
Echéance:
% réalisé:

0%

Temps estimé:
Patch proposed:
Non
Planning:
Non

Description

Dans l'optique de passer zoo en python3.

Révisions associées

Révision b3517e49 (diff)
Ajouté par Nicolas Roche il y a environ 4 ans

misc: add .gitignore (#40911)

Révision 46478781 (diff)
Ajouté par Nicolas Roche il y a environ 4 ans

python3: get urllib/urlparse from six (#40911)

Révision a15b4cdd (diff)
Ajouté par Nicolas Roche il y a environ 4 ans

python3: get StringIO from six (#40911)

Révision 921a3f27 (diff)
Ajouté par Nicolas Roche il y a environ 4 ans

python3: replace unicode references (#40911)

Révision dcb53519 (diff)
Ajouté par Nicolas Roche il y a environ 4 ans

python3: encode unicode-objects before hashing (#40911)

Révision f39cbee9 (diff)
Ajouté par Nicolas Roche il y a environ 4 ans

python3: replace response content with text (#40911)

Révision 02f660ca (diff)
Ajouté par Nicolas Roche il y a environ 4 ans

python3: pass bytes to Upload content (#40911)

Révision 55af5e1d (diff)
Ajouté par Nicolas Roche il y a environ 4 ans

python3: use text to manage csv content (#40911)

Révision 5311d34d (diff)
Ajouté par Nicolas Roche il y a environ 4 ans

python3: take reduce from functools package (#40911)

Révision 025fa0f2 (diff)
Ajouté par Nicolas Roche il y a environ 4 ans

python3: use listcomp insted of map object generator (#40911)

Révision e8792632 (diff)
Ajouté par Nicolas Roche il y a environ 4 ans

python3: replace .iteritems by .items (#40911)

Révision ec91ea59 (diff)
Ajouté par Nicolas Roche il y a environ 4 ans

python3: replace json string parser input by text (#40911)

Révision c20eb03a (diff)
Ajouté par Nicolas Roche il y a environ 4 ans

python3: open report files as binary (#40911)

FileReponse wants binary streams, but csv.reader() wants text streams.

Révision a964e71e (diff)
Ajouté par Nicolas Roche il y a environ 4 ans

python3: open django.core.files.storage in text mode for csv (#40911)

Révision 1aca22f7 (diff)
Ajouté par Nicolas Roche il y a environ 4 ans

python3: provide string representations (#40911)

Révision 5677795e (diff)
Ajouté par Nicolas Roche il y a environ 4 ans

python3: update tox to check against both python versions (#40911)

Révision 6c05e325 (diff)
Ajouté par Frédéric Péters il y a environ 3 ans

trivial: switch forgotten execfile() call to exec() (#40911)

Historique

#1

Mis à jour par Nicolas Roche il y a environ 4 ans

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

#2

Mis à jour par Nicolas Roche il y a environ 4 ans

  • Statut changé de Nouveau à Solution proposée
#3

Mis à jour par Benjamin Dauvergne il y a environ 4 ans

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.

#4

Mis à jour par Benjamin Dauvergne il y a environ 4 ans

  • Statut changé de Solution proposée à 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).

#5

Mis à jour par Nicolas Roche il y a environ 4 ans

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)

#6

Mis à jour par Benjamin Dauvergne il y a environ 4 ans

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.

#7

Mis à jour par Nicolas Roche il y a environ 4 ans

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

#8

Mis à jour par Benjamin Dauvergne il y a environ 4 ans

C'est toujours ok pour moi.

#9

Mis à jour par Nicolas Roche il y a environ 4 ans

  • Statut changé de Solution validée à 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.

#10

Mis à jour par Benjamin Dauvergne il y a environ 4 ans

ok.

#11

Mis à jour par Benjamin Dauvergne il y a environ 4 ans

  • Statut changé de Solution proposée à Solution validée
#12

Mis à jour par Nicolas Roche il y a environ 4 ans

  • Statut changé de Solution validée à 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)
#13

Mis à jour par Nicolas Roche il y a environ 4 ans

  • Statut changé de Résolu (à déployer) à Solution déployée

Formats disponibles : Atom PDF