Project

General

Profile

Bug #88103

Tests en erreur en local

Added by Yann Weber 4 months ago. Updated 15 days ago.

Status:
Fermé
Priority:
Normal
Assignee:
Category:
-
Target version:
-
Start date:
13 March 2024
Due date:
% Done:

0%

Estimated time:
Patch proposed:
No
Planning:
No

Description

J'ai 4 tests qui échouent en local. Si je comprend bien, il s'agit de problèmes de tri et de comptage de requêtes SQL.

La machine ou les tests échouent est une debian unstable avec psql (PostgreSQL) 16.2 (Debian 16.2-1)

FAILED tests/test_custom_user.py::test_fts_last_name - AssertionError: assert [('ROSSET', '...l', 0.0), ...] == [('ROSSET', '...l', 0.0), ...]
E       AssertionError: assert [('ROSSET', '...l', 0.0), ...] == [('ROSSET', '...l', 0.0), ...]
E         
E         At index 1 diff: ('ROSSET', 'JEAN PIERRE', 0.0) != ('ROSSET', 'Jean-Claude', 0.0)
E         Use -v to get more diff

tests/test_custom_user.py:188: AssertionError

FAILED tests/test_role_manager.py::test_role_members_user_role_mixed_field_choices - AssertionError: assert ['Default org...al unit', ...] == ['Default org...al unit', ...]
E       AssertionError: assert ['Default org...al unit', ...] == ['Default org...al unit', ...]
E         
E         At index 8 diff: 'OU1 - Roles - OU1' != 'OU1 - role_ou1'
E         Use -v to get more diff

tests/test_role_manager.py:611: AssertionError

FAILED tests/test_user_manager.py::test_user_table_num_queries - assert 21 == 23
E           assert 21 == 23
E            +  where 21 = len([{'sql': 'SELECT "django_session"."session_key", "django_session"."session_data", "django_session"."expire_date" FROM ...OM "a2_rbac_organizationalunit" WHERE 
NOT "a2_rbac_organizationalunit"."show_username" LIMIT 1', 'time': '0.000'}, ...])
E            +    where [{'sql': 'SELECT "django_session"."session_key", "django_session"."session_data", "django_session"."expire_date" FROM ...OM "a2_rbac_organizationalunit" WHERE NOT "a2
_rbac_organizationalunit"."show_username" LIMIT 1', 'time': '0.000'}, ...] = <django.test.utils.CaptureQueriesContext object at 0x7f7febe7df10>.captured_queries

tests/test_user_manager.py:581: AssertionError

FAILED tests/test_role_manager.py::test_role_table_ordering - AssertionError: assert ['A role', 'B...le', 'É role'] == ['a role', 'A...le', 'Z role']
E       AssertionError: assert ['A role', 'B...le', 'É role'] == ['a role', 'A...le', 'Z role']
E         
E         At index 0 diff: 'A role' != 'a role'
E         Use -v to get more diff

tests/test_role_manager.py:738: AssertionError

History

#1

Updated by Benjamin Dauvergne about 1 month ago

  • Status changed from Nouveau to Information nécessaire
  • Assignee set to Yann Weber

Est-ce toujours le cas ?

#2

Updated by Yann Weber about 1 month ago

J'en ai deux de plus en erreurs depuis. La liste complète :

FAILED tests/test_commands.py::test_clean_unused_account_login_url - UnicodeEncodeError: 'utf-8' codec can't encode characters in position 4-5: surrogates not allowed
FAILED tests/test_custom_user.py::test_fts_last_name - AssertionError: assert [('ROSSET', '...l', 0.0), ...] == [('ROSSET', '...l', 0.0), ...]
FAILED tests/test_role_manager.py::test_role_members_user_role_mixed_table - AssertionError: assert ['Members of ...', 'Jôhn Dôe'] == ['Members of ...', 'Jôhn Dôe']
FAILED tests/test_role_manager.py::test_role_members_user_role_mixed_field_choices - AssertionError: assert ['Default org...al unit', ...] == ['Default org...al unit', ...]
FAILED tests/test_role_manager.py::test_role_table_ordering - AssertionError: assert ['A role', 'B...le', 'É role'] == ['a role', 'A...le', 'Z role']
FAILED tests/test_user_manager.py::test_user_table_num_queries - assert 21 == 23
#3

Updated by Yann Weber 16 days ago

  • Assignee changed from Yann Weber to Benjamin Dauvergne
#4

Updated by Benjamin Dauvergne 16 days ago

  • Assignee changed from Benjamin Dauvergne to Yann Weber

Tu pourrais me donner le résultat de sudo -u postgres psql -l | grep template ? Peut-être que tes bases templates ne sont pas dans la locale française.

#5

Updated by Yann Weber 16 days ago

  • Assignee changed from Yann Weber to Benjamin Dauvergne

Benjamin Dauvergne a écrit :

Tu pourrais me donner le résultat de sudo -u postgres psql -l | grep template ? Peut-être que tes bases templates ne sont pas dans la locale française.

 template0                    | postgres | UTF8     | libc            | C.UTF-8 | C.UTF-8 |            |           | =c/postgres          +
 template1                    | postgres | UTF8     | libc            | C.UTF-8 | C.UTF-8 |            |           | =c/postgres          +

Effectivement, je ne vois pas de trace de locale française !

#6

Updated by Benjamin Dauvergne 15 days ago

En local j'ai juste l'erreur de locale unicode, c'est un bug entre django 3.x et python3.11 il me semble (je vais retrouver le rapport de bug).

Donc pour les locales il faut faire cela (à recommencer avec template1)

CREATE DATABASE new_template0
WITH OWNER = postgres
   ENCODING = 'UTF8'
   TABLESPACE = pg_default
   LC_COLLATE = 'fr_FR.UTF-8'
   LC_CTYPE = 'fr_FR.UTF-8'
   CONNECTION LIMIT = -1
   TEMPLATE template0;
ALTER DATABASE template0 is_template=false;
DROP DATABASE template0;
ALTER DATABASE new_template0 rename to template0;
ALTER DATABASE template0 is_template=true;

#7

Updated by Benjamin Dauvergne 15 days ago

"Send mail throws UnicodeEncodeError under python 3.11.9"
https://forum.djangoproject.com/t/send-mail-throws-unicodeencodeerror-under-python-3-11-9/29871

Ça va aller en prod parce qu'on est qu'en python 3.11.2 mais la correction c'est le passage en Django 4.2.x.

#8

Updated by Benjamin Dauvergne 15 days ago

  • Status changed from Information nécessaire to En cours
  • Assignee changed from Benjamin Dauvergne to Yann Weber
#9

Updated by Frédéric Péters 15 days ago

Pour info pour le "surrogates not allowed", côté publik-devinst normalement l'installation de django est patchée : #89506

#10

Updated by Yann Weber 15 days ago

Super, merci, c'est bien mieux :)

#11

Updated by Yann Weber 15 days ago

  • Status changed from En cours to Fermé

Also available in: Atom PDF