8000 travis: Add MySQL 8.0 (#663) · vicdeveloper/PyMySQL@49a64f3 · GitHub
[go: up one dir, main page]

Skip to content

Commit 49a64f3

Browse files
grooverdanmethane
authored andcommitted
travis: Add MySQL 8.0 (PyMySQL#663)
1 parent db20bf2 commit 49a64f3

File tree

3 files changed

+25
-9
lines changed

3 files changed

+25
-9
lines changed

.travis.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,9 @@ matrix:
3333
- env:
3434
- DB=mysql:5.7
3535
python: "3.4"
36+
- env:
37+
- DB=mysql:8.0
38+
python: "3.7-dev"
3639

3740
# different py version from 5.6 and 5.7 as cache seems to be based on py version
3841
# http://dev.mysql.com/downloads/mysql/5.7.html has latest development release version

.travis/initializedb.sh

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,25 +13,39 @@ if [ ! -z "${DB}" ]; then
1313
docker run -it --name=mysqld -d -e MYSQL_ALLOW_EMPTY_PASSWORD=yes -p 3306:3306 ${DB}
1414
sleep 10
1515

16+
mysql() {
17+
docker exec mysqld mysql "${@}"
18+
}
1619
while :
1720
do
1821
sleep 5
19-
mysql -uroot -h 127.0.0.1 -P 3306 -e 'select version()'
22+
mysql -e 'select version()'
2023
if [ $? = 0 ]; then
2124
break
2225
fi
2326
echo "server logs"
2427
docker logs --tail 5 mysqld
2528
done
2629

27-
echo -e "[client]\nhost = 127.0.0.1\n" > "${HOME}"/.my.cnf
28-
2930
mysql -e 'select VERSION()'
30-
mysql -uroot -e 'create database test1 DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;'
31-
mysql -uroot -e 'create database test2 DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;'
3231

33-
mysql -u root -e "create user test2 identified by 'some password'; grant all on test2.* to test2;"
34-
mysql -u root -e "create user test2@localhost identified by 'some password'; grant all on test2.* to test2@localhost;"
32+
if [ $DB == 'mysql:8.0' ]; then
33+
WITH_PLUGIN='with mysql_native_password'
34+
mysql -e 'SET GLOBAL local_infile=on'
35+
docker cp mysqld:/var/lib/mysql/public_key.pem "${HOME}"
36+
docker cp mysqld:/var/lib/mysql/ca.pem "${HOME}"
37+
docker cp mysqld:/var/lib/mysql/server-cert.pem "${HOME}"
38+
docker cp mysqld:/var/lib/mysql/client-key.pem "${HOME}"
39+
docker cp mysqld:/var/lib/mysql/client-cert.pem "${HOME}"
40+
else
41+
WITH_PLUGIN=''
42+
fi
43+
44+
mysql -uroot -e 'create database test1 DEFAULT CHARACTER SET utf8mb4'
45+
mysql -uroot -e 'create database test2 DEFAULT CHARACTER SET utf8mb4'
46+
47+
mysql -u root -e "create user test2 identified ${WITH_PLUGIN} by 'some password'; grant all on test2.* to test2;"
48+
mysql -u root -e "create user test2@localhost identified ${WITH_PLUGIN} by 'some password'; grant all on test2.* to test2@localhost;"
3549

3650
cp .travis/docker.json pymysql/tests/databases.json
3751
else

pymysql/tests/thirdparty/test_MySQLdb/test_MySQLdb_capabilities.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,8 @@ class test_MySQLdb(capabilities.DatabaseTest):
1616
connect_kwargs = base.PyMySQLTestCase.databases[0].copy()
1717
connect_kwargs.update(dict(read_default_file='~/.my.cnf',
1818
use_unicode=True, binary_prefix=True,
19-
charset='utf8', sql_mode="ANSI,STRICT_TRANS_TABLES,TRADITIONAL"))
19+
charset='utf8mb4', sql_mode="ANSI,STRICT_TRANS_TABLES,TRADITIONAL"))
2020

21-
create_table_extra = "ENGINE=INNODB CHARACTER SET UTF8"
2221
leak_test = False
2322

2423
def quote_identifier(self, ident):

0 commit comments

Comments
 (0)
0