Skip to content

Commit cc9fc83

Browse files
committed
Switch MySQL driver to MySQL-connector
1 parent d38a3bb commit cc9fc83

File tree

3 files changed

+21
-9
lines changed

3 files changed

+21
-9
lines changed

requirements-py3.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
-e git+https://github.com/RDFLib/rdflib.git#egg=rdflib
22
psycopg2
3-
-e git+https://github.com/davispuh/MySQL-for-Python-3#egg=MySQL-python
3+
http://cdn.mysql.com/Downloads/Connector-Python/mysql-connector-python-1.0.10.zip
4+
# -e git+https://github.com/davispuh/MySQL-for-Python-3#egg=MySQL-python

test/test_sqlalchemy_mysql.py

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,21 @@
11
import unittest
22
from nose import SkipTest
3+
from rdflib.py3compat import PY3
34
import os
45
if os.environ.get('DB') != 'mysql':
56
raise SkipTest("MySQL not under test")
6-
try:
7-
import MySQLdb
8-
except ImportError:
9-
raise SkipTest("MySQLdb not found, skipping MySQL tests")
7+
if PY3:
8+
try:
9+
import mysql
10+
assert mysql
11+
except ImportError:
12+
raise SkipTest("MySQL-connector not found, skipping MySQL tests")
13+
else:
14+
try:
15+
import MySQLdb
16+
assert MySQLdb
17+
except ImportError:
18+
raise SkipTest("MySQLdb not found, skipping MySQL tests")
1019
import logging
1120
_logger = logging.getLogger(__name__)
1221
from . import context_case
@@ -16,7 +25,7 @@
1625
# Specific to Travis-ci continuous integration and testing ...
1726
sqlalchemy_url = Literal(os.environ.get(
1827
'DBURI',
19-
"mysql://[email protected]:3306/rdflibsqla_test?charset=utf8"))
28+
"mysql+mysqlconnector://[email protected]:3306/rdflibsqla_test?charset=utf8"))
2029
# Generally ...
2130
# sqlalchemy_url = Literal(
2231
# "mysql+mysqldb://user:password@hostname:port/database?charset=utf8")
@@ -52,7 +61,7 @@ def tearDown(self):
5261
def testLenInMultipleContexts(self):
5362
raise SkipTest("Known issue.")
5463

55-
64+
5665
class SQLAMySQLIssueTestCase(unittest.TestCase):
5766
storetest = True
5867
storename = "SQLAlchemy"

tox.ini

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,8 @@ deps =
3737
git+http://github.com/RDFLib/rdflib#egg=rdflib
3838
SQLAlchemy
3939
psycopg2
40-
git+https://github.com/davispuh/MySQL-for-Python-3#egg=MySQL-python
40+
http://cdn.mysql.com/Downloads/Connector-Python/mysql-connector-python-1.0.10.zip
41+
# git+https://github.com/davispuh/MySQL-for-Python-3#egg=MySQL-python
4142
# lxml
4243

4344
[testenv:py33]
@@ -51,7 +52,8 @@ deps =
5152
git+http://github.com/RDFLib/rdflib#egg=rdflib
5253
SQLAlchemy
5354
psycopg2
54-
git+https://github.com/davispuh/MySQL-for-Python-3#egg=MySQL-python
55+
http://cdn.mysql.com/Downloads/Connector-Python/mysql-connector-python-1.0.10.zip
56+
# git+https://github.com/davispuh/MySQL-for-Python-3#egg=MySQL-python
5557
# oursql
5658
# lxml
5759

0 commit comments

Comments
 (0)