[PATCH 03 of 10 logilab-database] [test] Make MySQL-python dependency optional

Denis Laxalde denis.laxalde at logilab.fr
Mon Jun 4 12:00:18 CEST 2018


# HG changeset patch
# User Denis Laxalde <denis.laxalde at logilab.fr>
# Date 1528102021 -7200
#      Mon Jun 04 10:47:01 2018 +0200
# Node ID d62581228272e35db2b93d66e0e76dd6c7d435c0
# Parent  f45081747a566054960ec65e86cb1d22bd912524
# Available At https://hg.logilab.org/review/logilab/database
#              hg pull https://hg.logilab.org/review/logilab/database -r d62581228272
# EXP-Topic py3
[test] Make MySQL-python dependency optional

Who cares about MySQL nowadays?

More seriously, this dependency requires compile-time mysql
libraries/executable and I have no time to investigate how to set this
up (especially in a CI environment).

diff --git a/test/unittest_mysql.py b/test/unittest_mysql.py
--- a/test/unittest_mysql.py
+++ b/test/unittest_mysql.py
@@ -28,7 +28,10 @@ class MyHelperTC(unittest.TestCase):
 
     def setUp(self):
         self.cnx = MockConnection( () )
-        self.helper = get_db_helper('mysql')
+        try:
+            self.helper = get_db_helper('mysql')
+        except ImportError as exc:
+            raise unittest.SkipTest(str(exc))
         self.helper._cnx = self.cnx
 
     def test_type_map(self):
diff --git a/tox.ini b/tox.ini
--- a/tox.ini
+++ b/tox.ini
@@ -4,5 +4,4 @@ envlist=py27,py3
 [testenv]
 deps =
   psycopg2
-  py27: MySQL-python
 commands=pytest -t test


More information about the cubicweb-devel mailing list