[PATCH 05 of 10 logilab-database] [test] Do not rely on mysql in test_register_funcdef

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


# HG changeset patch
# User Denis Laxalde <denis.laxalde at logilab.fr>
# Date 1528102551 -7200
#      Mon Jun 04 10:55:51 2018 +0200
# Node ID 709de493f9fedbaef1abd2206bad908438cfce4f
# Parent  0d74e46786b465d329ccbe7bec9597c0bca43c5b
# Available At https://hg.logilab.org/review/logilab/database
#              hg pull https://hg.logilab.org/review/logilab/database -r 709de493f9fe
# EXP-Topic py3
[test] Do not rely on mysql in test_register_funcdef

This test (as far as I understand) checks for registration of functions
by a backend helper. It used mysql helper to detect unregistered
functions but there's nothing specific to mysql in this process, so we
now use sqlite instead.

diff --git a/test/unittest_db.py b/test/unittest_db.py
--- a/test/unittest_db.py
+++ b/test/unittest_db.py
@@ -178,24 +178,19 @@ class DBAPIAdaptersTC(unittest.TestCase)
 
     def test_register_funcdef(self):
         class MYFUNC(FunctionDescr):
-            supported_backends = ('postgres', 'sqlite',)
+            supported_backends = ('postgres', )
             name_mapping = {'postgres': 'MYFUNC',
                             'mysql': 'MYF',
                             'sqlite': 'SQLITE_MYFUNC'}
         register_function(MYFUNC)
 
         pghelper = get_db_helper('postgres')
-        mshelper = get_db_helper('mysql')
         slhelper = get_db_helper('sqlite')
-        self.assertRaises(UnsupportedFunction, mshelper.function_description, 'MYFUNC')
+        self.assertRaises(UnsupportedFunction, slhelper.function_description, 'MYFUNC')
         try:
             pghelper.function_description('MYFUNC')
         except UnsupportedFunction:
             self.fail('MYFUNC should support "postgres"')
-        try:
-            slhelper.function_description('MYFUNC')
-        except UnsupportedFunction:
-            self.fail('MYFUNC should support "sqlite"')
 
     def test_funcname_with_different_backend_names(self):
         class MYFUNC(FunctionDescr):


More information about the cubicweb-devel mailing list