Merge lp:~cjwatson/storm/mysql-8.0.24-compat into lp:storm

Proposed by Colin Watson
Status: Merged
Merged at revision: 574
Proposed branch: lp:~cjwatson/storm/mysql-8.0.24-compat
Merge into: lp:storm
Diff against target: 74 lines (+17/-5)
5 files modified
NEWS (+8/-0)
dev/test (+2/-1)
storm/databases/mysql.py (+4/-1)
storm/tests/databases/mysql.py (+2/-2)
storm/tests/store/base.py (+1/-1)
To merge this branch: bzr merge lp:~cjwatson/storm/mysql-8.0.24-compat
Reviewer Review Type Date Requested Status
Ioana Lasc Approve
Storm Developers Pending
Review via email: mp+402725@code.launchpad.net

Commit message

Fix test compatibility with MySQL >= 8.0.24.

Description of the change

https://dev.mysql.com/doc/relnotes/mysql/8.0/en/news-8-0-24.html says:

   Client applications and test suite plugins now report utf8mb3 rather than utf8 when writing character set names. (Bug #32164079, Bug #32164125)

This broke the Storm test suite. Adjust it slightly to cope. Ideally we should use utf8mb4 instead, but I'm not quite sure to what extent this might break existing applications, so stick to what we know for now.

To post a comment you must log in.
Revision history for this message
Ioana Lasc (ilasc) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'NEWS'
2--- NEWS 2021-04-19 09:52:52 +0000
3+++ NEWS 2021-05-13 23:05:18 +0000
4@@ -1,3 +1,11 @@
5+0.26
6+====
7+
8+Bug fixes
9+---------
10+
11+- Fix test compatibility with MySQL >= 8.0.24.
12+
13 0.25 (2021-04-19)
14 =================
15
16
17=== modified file 'dev/test'
18--- dev/test 2021-04-06 09:23:02 +0000
19+++ dev/test 2021-05-13 23:05:18 +0000
20@@ -205,7 +205,8 @@
21 cursor = connection.cursor()
22 try:
23 cursor.execute(
24- "CREATE DATABASE storm_test CHARACTER SET utf8;")
25+ "CREATE DATABASE storm_test "
26+ "CHARACTER SET utf8mb4;")
27 finally:
28 cursor.close()
29 finally:
30
31=== modified file 'storm/databases/mysql.py'
32--- storm/databases/mysql.py 2021-04-06 09:23:02 +0000
33+++ storm/databases/mysql.py 2021-05-13 23:05:18 +0000
34@@ -167,7 +167,10 @@
35
36 self._connect_kwargs["conv"] = self._converters
37 self._connect_kwargs["use_unicode"] = True
38- self._connect_kwargs["charset"] = uri.options.get("charset", "utf8")
39+ # utf8mb3 (a.k.a. utf8) is deprecated, but it's not clear that we
40+ # can change it without breaking applications. Default to utf8mb3
41+ # for now.
42+ self._connect_kwargs["charset"] = uri.options.get("charset", "utf8mb3")
43
44 def _raw_connect(self):
45 raw_connection = ConnectionWrapper(
46
47=== modified file 'storm/tests/databases/mysql.py'
48--- storm/tests/databases/mysql.py 2021-04-06 09:23:02 +0000
49+++ storm/tests/databases/mysql.py 2021-05-13 23:05:18 +0000
50@@ -78,9 +78,9 @@
51 ("unix_socket", "us")]:
52 self.assertEqual(database._connect_kwargs.get(key), value)
53
54- def test_charset_defaults_to_utf8(self):
55+ def test_charset_defaults_to_utf8mb3(self):
56 result = self.connection.execute("SELECT @@character_set_client")
57- self.assertEqual(result.get_one(), ("utf8",))
58+ self.assertEqual(result.get_one(), ("utf8mb3",))
59
60 def test_charset_option(self):
61 uri = URI(os.environ["STORM_MYSQL_URI"])
62
63=== modified file 'storm/tests/store/base.py'
64--- storm/tests/store/base.py 2021-04-06 09:23:02 +0000
65+++ storm/tests/store/base.py 2021-05-13 23:05:18 +0000
66@@ -6039,7 +6039,7 @@
67 except AssertionError as e:
68 raise AssertionError(six.text_type(e, 'replace') +
69 " (ensure your database was created with CREATE DATABASE"
70- " ... CHARACTER SET utf8)")
71+ " ... CHARACTER SET utf8mb3)")
72
73 def test_creation_order_is_preserved_when_possible(self):
74 foos = [self.store.add(Foo()) for i in range(10)]

Subscribers

People subscribed via source and target branches

to status/vote changes: