Skip to content

Commit 9e33c9b

Browse files
committed
Adding mysql-connector dependency to tox for supported python3 versions
- Also pulling before_install into a separate script so it's more readable - Using mysql-connector for mysql tests in python3 on Travis-CI
1 parent c5c83fa commit 9e33c9b

File tree

3 files changed

+26
-10
lines changed

3 files changed

+26
-10
lines changed

.travis.yml

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,7 @@ install:
2020
- pip install -U setuptools tox tox-travis
2121

2222
before_script:
23-
- sh -c "if [ '$DB' = 'pgsql' ]; then psql -c 'DROP DATABASE IF EXISTS test;' -U postgres;
24-
psql -c 'create database test;' -U postgres; export DBURI='postgresql+psycopg2://postgres@localhost/test';
25-
fi"
26-
- sh -c "if [ '$DB' = 'mysql' ]; then mysql -e 'CREATE SCHEMA test DEFAULT CHARACTER SET utf8;';
27-
export DBURI='mysql+mysqldb://test@localhost/test?charset=utf8'; fi"
28-
- sh -c "if [ '$DB' = 'sqlite' ]; then export DBURI='sqlite:///%(here)s/test.sqlite';
29-
fi"
23+
- ./travis-ci.sh
3024

3125
script: tox
3226

tox.ini

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ commands =
1010
deps =
1111
psycopg2
1212
mysqlclient
13+
py{34,35,36,37}: mysql-connector
1314

1415
[testenv:lint]
1516
commands = flake8 rdflib_sqlalchemy test
@@ -27,9 +28,10 @@ deps =
2728
psycopg2
2829
mysqlclient
2930

30-
[tox:travis]
31-
2.7 = py27, cover, lint
32-
3.5 = py35, lint
31+
[travis]
32+
python =
33+
2.7: py27, cover, lint
34+
3.5: py35, lint
3335

3436
[flake8]
3537
max-line-length = 120

travis-ci.sh

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#!/bin/bash -ex
2+
3+
if [ "$DB" = 'pgsql' ]; then
4+
psql -c 'DROP DATABASE IF EXISTS test;' -U postgres
5+
psql -c 'create database test;' -U postgres
6+
export DBURI='postgresql+psycopg2://postgres@localhost/test'
7+
fi
8+
9+
if [ "$DB" = 'mysql' ]; then
10+
mysql -e 'CREATE SCHEMA test DEFAULT CHARACTER SET utf8;'
11+
if [[ "$TRAVIS_PYTHON_VERSION" =~ '.*3\.[4567].*' ]] ; then
12+
export DBURI='mysql+mysqlconnector://test@localhost/test?charset=utf8'
13+
else
14+
export DBURI='mysql+mysqldb://test@localhost/test?charset=utf8'
15+
fi
16+
fi
17+
18+
if [ "$DB" = 'sqlite' ]; then
19+
export DBURI='sqlite:///%(here)s/test.sqlite'
20+
fi

0 commit comments

Comments
 (0)