[PATCH 02 of 10 logilab-database] [test] Avoid using lgc's testlib

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


# HG changeset patch
# User Denis Laxalde <denis.laxalde at logilab.fr>
# Date 1528101661 -7200
#      Mon Jun 04 10:41:01 2018 +0200
# Node ID f45081747a566054960ec65e86cb1d22bd912524
# Parent  a396e255f6f7f4e06b412e52d8216ee1c123f153
# Available At https://hg.logilab.org/review/logilab/database
#              hg pull https://hg.logilab.org/review/logilab/database -r f45081747a56
# EXP-Topic py3
[test] Avoid using lgc's testlib

diff --git a/test/unittest_db.py b/test/unittest_db.py
--- a/test/unittest_db.py
+++ b/test/unittest_db.py
@@ -22,9 +22,10 @@ from __future__ import print_function
 from __future__ import with_statement
 
 import socket
+import unittest
 
 from six.moves import range
-from logilab.common.testlib import TestCase, unittest_main
+
 from logilab.common.shellutils import getlogin
 from logilab.database import *
 from logilab.database import _PREFERED_DRIVERS as PREFERED_DRIVERS
@@ -40,7 +41,7 @@ from logilab.database import mysql, sqls
 
 
 
-class PreferedDriverTC(TestCase):
+class PreferedDriverTC(unittest.TestCase):
     def setUp(self):
         self.drivers = {"pg":[('foo', None), ('bar', None)]}
         self.drivers = {'pg' : ["foo", "bar"]}
@@ -78,7 +79,7 @@ class PreferedDriverTC(TestCase):
         self.assertEqual(PREFERED_DRIVERS['postgres'], expected)
 
 
-class GetCnxTC(TestCase):
+class GetCnxTC(unittest.TestCase):
     def setUp(self):
         self.host = 'localhost'
         try:
@@ -148,7 +149,7 @@ class GetCnxTC(TestCase):
                         'cnx should be a PyCursor instance')
 
 
-class DBAPIAdaptersTC(TestCase):
+class DBAPIAdaptersTC(unittest.TestCase):
     """Tests DbApi adapters management"""
 
     def setUp(self):
@@ -211,7 +212,7 @@ class DBAPIAdaptersTC(TestCase):
         self.assertEqual(pghelper.func_as_sql('MYFUNC', ('foo',)), 'MYFUNC(foo)')
         self.assertEqual(mshelper.func_as_sql('MYFUNC', ('foo', 'bar')), 'MYF(foo, bar)')
 
-class BaseSqlServer(TestCase):
+class BaseSqlServer(unittest.TestCase):
     def tearDown(self):
         cursor = self.cnx.cursor()
         cursor.execute('drop table TestBlob')
@@ -323,7 +324,7 @@ else:
             self.varbinary_none()
 
 
-class PostgresqlDatabaseSchemaTC(TestCase):
+class PostgresqlDatabaseSchemaTC(unittest.TestCase):
     host = 'localhost'
     database = 'template1'
     user = password = getlogin()
@@ -407,4 +408,4 @@ class PostgresqlDatabaseSchemaTC(TestCas
 
 
 if __name__ == '__main__':
-    unittest_main()
+    unittest.main()
diff --git a/test/unittest_fti.py b/test/unittest_fti.py
--- a/test/unittest_fti.py
+++ b/test/unittest_fti.py
@@ -18,7 +18,7 @@
 # with logilab-database. If not, see <http://www.gnu.org/licenses/>.
 import unittest
 
-from logilab.common.testlib import MockConnection, TestCase
+from logilab.common.testlib import MockConnection
 
 from logilab.database.fti import FTIndexerMixIn, tokenize, normalize, \
      StopWord
@@ -55,7 +55,7 @@ class IndexableObject:
                 'B': tokenize(u'cubic 456')}
 
 
-class IndexerTC(TestCase):
+class IndexerTC(unittest.TestCase):
 
     def setUp(self):
         self.cnx = MockConnection( ([1, 2],) )
@@ -98,7 +98,7 @@ class IndexerTC(TestCase):
                            ])
 
 
-class GetSchemaTC(TestCase):
+class GetSchemaTC(unittest.TestCase):
 
     def test(self):
         indexer = FTIndexerMixIn()
diff --git a/test/unittest_postgres.py b/test/unittest_postgres.py
--- a/test/unittest_postgres.py
+++ b/test/unittest_postgres.py
@@ -17,14 +17,14 @@
 # with logilab-database. If not, see <http://www.gnu.org/licenses/>.
 import unittest
 
-from logilab.common.testlib import TestCase, MockConnection
+from logilab.common.testlib import MockConnection
 
 from unittest_fti import IndexableObject
 
 from logilab.database import get_db_helper
 
 
-class PGHelperTC(TestCase):
+class PGHelperTC(unittest.TestCase):
     def setUp(self):
         self.helper = get_db_helper('postgres')
         self.cnx = MockConnection( () )
diff --git a/test/unittest_sqlserver2005.py b/test/unittest_sqlserver2005.py
--- a/test/unittest_sqlserver2005.py
+++ b/test/unittest_sqlserver2005.py
@@ -20,7 +20,7 @@ from __future__ import print_function
 import sys
 import unittest
 
-from logilab.common.testlib import TestCase, MockConnection
+from logilab.common.testlib import MockConnection
 
 from logilab.database import get_db_helper
 
@@ -50,7 +50,7 @@ def tearDownModule():
     db._import_driver_module = db._backup_import_driver_module
     del db._backup_import_driver_module
 
-class SqlServer2005HelperTC(TestCase):
+class SqlServer2005HelperTC(unittest.TestCase):
     def setUp(self):
         self.helper = get_db_helper('sqlserver2005')
         self.cnx = MockConnection( () )


More information about the cubicweb-devel mailing list