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 (community) 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
=== modified file 'NEWS'
--- NEWS 2021-04-19 09:52:52 +0000
+++ NEWS 2021-05-13 23:05:18 +0000
@@ -1,3 +1,11 @@
10.26
2====
3
4Bug fixes
5---------
6
7- Fix test compatibility with MySQL >= 8.0.24.
8
10.25 (2021-04-19)90.25 (2021-04-19)
2=================10=================
311
412
=== modified file 'dev/test'
--- dev/test 2021-04-06 09:23:02 +0000
+++ dev/test 2021-05-13 23:05:18 +0000
@@ -205,7 +205,8 @@
205 cursor = connection.cursor()205 cursor = connection.cursor()
206 try:206 try:
207 cursor.execute(207 cursor.execute(
208 "CREATE DATABASE storm_test CHARACTER SET utf8;")208 "CREATE DATABASE storm_test "
209 "CHARACTER SET utf8mb4;")
209 finally:210 finally:
210 cursor.close()211 cursor.close()
211 finally:212 finally:
212213
=== modified file 'storm/databases/mysql.py'
--- storm/databases/mysql.py 2021-04-06 09:23:02 +0000
+++ storm/databases/mysql.py 2021-05-13 23:05:18 +0000
@@ -167,7 +167,10 @@
167167
168 self._connect_kwargs["conv"] = self._converters168 self._connect_kwargs["conv"] = self._converters
169 self._connect_kwargs["use_unicode"] = True169 self._connect_kwargs["use_unicode"] = True
170 self._connect_kwargs["charset"] = uri.options.get("charset", "utf8")170 # utf8mb3 (a.k.a. utf8) is deprecated, but it's not clear that we
171 # can change it without breaking applications. Default to utf8mb3
172 # for now.
173 self._connect_kwargs["charset"] = uri.options.get("charset", "utf8mb3")
171174
172 def _raw_connect(self):175 def _raw_connect(self):
173 raw_connection = ConnectionWrapper(176 raw_connection = ConnectionWrapper(
174177
=== modified file 'storm/tests/databases/mysql.py'
--- storm/tests/databases/mysql.py 2021-04-06 09:23:02 +0000
+++ storm/tests/databases/mysql.py 2021-05-13 23:05:18 +0000
@@ -78,9 +78,9 @@
78 ("unix_socket", "us")]:78 ("unix_socket", "us")]:
79 self.assertEqual(database._connect_kwargs.get(key), value)79 self.assertEqual(database._connect_kwargs.get(key), value)
8080
81 def test_charset_defaults_to_utf8(self):81 def test_charset_defaults_to_utf8mb3(self):
82 result = self.connection.execute("SELECT @@character_set_client")82 result = self.connection.execute("SELECT @@character_set_client")
83 self.assertEqual(result.get_one(), ("utf8",))83 self.assertEqual(result.get_one(), ("utf8mb3",))
8484
85 def test_charset_option(self):85 def test_charset_option(self):
86 uri = URI(os.environ["STORM_MYSQL_URI"])86 uri = URI(os.environ["STORM_MYSQL_URI"])
8787
=== modified file 'storm/tests/store/base.py'
--- storm/tests/store/base.py 2021-04-06 09:23:02 +0000
+++ storm/tests/store/base.py 2021-05-13 23:05:18 +0000
@@ -6039,7 +6039,7 @@
6039 except AssertionError as e:6039 except AssertionError as e:
6040 raise AssertionError(six.text_type(e, 'replace') +6040 raise AssertionError(six.text_type(e, 'replace') +
6041 " (ensure your database was created with CREATE DATABASE"6041 " (ensure your database was created with CREATE DATABASE"
6042 " ... CHARACTER SET utf8)")6042 " ... CHARACTER SET utf8mb3)")
60436043
6044 def test_creation_order_is_preserved_when_possible(self):6044 def test_creation_order_is_preserved_when_possible(self):
6045 foos = [self.store.add(Foo()) for i in range(10)]6045 foos = [self.store.add(Foo()) for i in range(10)]

Subscribers

People subscribed via source and target branches

to status/vote changes: