changeset 6760:38e0fc1c7f11

issue2551216 - create mysql databases using COLLATE utf8_general_ci Otherwise the test suite crashes in three tests under python2. With python3 the crash does not happaen, but python3 passes with this change as well.
author John Rouillard <rouilj@ieee.org>
date Sun, 10 Jul 2022 15:49:39 -0400
parents eccb2f53566d
children 65da8d74c06e
files .travis.yml CHANGES.txt roundup/backends/back_mysql.py
diffstat 3 files changed, 3 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/.travis.yml	Tue Jul 05 19:45:12 2022 -0400
+++ b/.travis.yml	Sun Jul 10 15:49:39 2022 -0400
@@ -139,12 +139,6 @@
   # set up postgresql database
   - psql -c "CREATE ROLE rounduptest WITH CREATEDB LOGIN PASSWORD 'rounduptest';" -U postgres
 
-  # HACK: workaround mysql bug: http://bugs.mysql.com/bug.php?id=74901
-  #   needed for test_mysql.mysqlDBTest.testFilteringSpecialChars
-  # plus others. Otherwise we get:
-  # COLLATION 'utf8_bin' is not valid for CHARACTER SET 'utf8mb4'
-  - sed -i 's/CREATE DATABASE \%s/CREATE DATABASE \%s COLLATE utf8_general_ci/' roundup/backends/back_mysql.py
-
   # build the .mo translation files and install them into a tree
   # (locale/locale under roundup directory root) 
   # suitable for use by gettext.
--- a/CHANGES.txt	Tue Jul 05 19:45:12 2022 -0400
+++ b/CHANGES.txt	Sun Jul 10 15:49:39 2022 -0400
@@ -112,6 +112,8 @@
   frontend. (John Rouillard)
 - prevent submit button from showing up when using _generic.item.html
   if the user doesn't have edit permissions. (John Rouillard)
+- issue2551216 - create new mysql databases using COLLATE
+  utf8_general_ci to prevent crashes in test suite. (John Rouillard)
 
 Features:
 
--- a/roundup/backends/back_mysql.py	Tue Jul 05 19:45:12 2022 -0400
+++ b/roundup/backends/back_mysql.py	Sun Jul 10 15:49:39 2022 -0400
@@ -92,7 +92,7 @@
     kwargs = connection_dict(config)
     conn = MySQLdb.connect(**kwargs)
     cursor = conn.cursor()
-    command = "CREATE DATABASE %s"%config.RDBMS_NAME
+    command = "CREATE DATABASE %s COLLATE utf8_general_ci"%config.RDBMS_NAME
     if sys.version_info[0] > 2:
         command += ' CHARACTER SET utf8'
     logging.info(command)

Roundup Issue Tracker: http://roundup-tracker.org/