Skip to content

Fix tests with MySQL 8.0 #501

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 3, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions tests/test_MySQLdb_capabilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,19 +182,19 @@ def test_binary_prefix(self):
for binary_prefix in (True, False, None):
kwargs = self.connect_kwargs.copy()
# needs to be set to can guarantee CHARSET response for normal strings
kwargs["charset"] = "utf8"
kwargs["charset"] = "utf8mb4"
if binary_prefix is not None:
kwargs["binary_prefix"] = binary_prefix

with closing(connection_factory(**kwargs)) as conn:
with closing(conn.cursor()) as c:
c.execute("SELECT CHARSET(%s)", (MySQLdb.Binary(b"raw bytes"),))
self.assertEqual(
c.fetchall()[0][0], "binary" if binary_prefix else "utf8"
c.fetchall()[0][0], "binary" if binary_prefix else "utf8mb4"
)
# normal strings should not get prefix
c.execute("SELECT CHARSET(%s)", ("str",))
self.assertEqual(c.fetchall()[0][0], "utf8")
self.assertEqual(c.fetchall()[0][0], "utf8mb4")


if __name__ == "__main__":
Expand Down