]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
fix failing test due to sybase paramstyle
authorMike Bayer <mike_mp@zzzcomputing.com>
Sun, 14 Mar 2010 23:50:50 +0000 (19:50 -0400)
committerMike Bayer <mike_mp@zzzcomputing.com>
Sun, 14 Mar 2010 23:50:50 +0000 (19:50 -0400)
CHANGES
doc/build/dbengine.rst
lib/sqlalchemy/test/engines.py
test/sql/test_functions.py

diff --git a/CHANGES b/CHANGES
index b33bf4b26294bc3cd6f1e2e3e939a819d0210557..5a8cf7aac89369f2046c074c29d9520e1f062dc9 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -352,6 +352,13 @@ CHANGES
      compatible with the "func.current_date()", which 
      will be returned as a string. [ticket:1685]
 
+- sybase
+   - Implemented a preliminary working dialect for Sybase
+     based on the Python-Sybase driver.  Handles table
+     creates/drops and basic round trip functionality.
+     Does not yet include reflection or comprehensive
+     support of unicode/special expressions/etc.
+     
 - examples
    - Changed the beaker cache example a bit to have a separate
      RelationCache option for lazyload caching.  This object
index 7aa306bb8abbdb3b8e454c5423ca89fdbf3f91a6..5c61a67d8ab22c052dd9c832d8aac57d802701d6 100644 (file)
@@ -119,7 +119,7 @@ sqlite3_                   ``sqlite+pysqlite``\*        yes          yes
 -------------------------------------------------------------------------------------------------------------------------------
 mxodbc_                    ``sybase+mxodbc``            development  development   no           yes                yes
 pyodbc_                    ``sybase+pyodbc``            development  development   no           unknown            unknown
-python-sybase_             ``sybase+pysybase``\*        development  development   no           yes                yes
+python-sybase_             ``sybase+pysybase``\*        partial      development   no           yes                yes
 =========================  ===========================  ===========  ===========   ===========  =================  ============
 
 .. _psycopg2: http://www.initd.org/
index 2f3d11bda656fd3240340e09f84049de85d94f3b..58bfe2b3c1b8b3c01bad2866d18d255a6183f18f 100644 (file)
@@ -80,10 +80,12 @@ def close_open_connections(fn):
             testing_reaper.close_all()
     return function_named(decorated, fn.__name__)
 
-def all_dialects():
+def all_dialects(exclude=None):
     import sqlalchemy.databases as d
     for name in d.__all__:
         # TEMPORARY
+        if exclude and name in exclude:
+            continue
         mod = getattr(d, name, None)
         if not mod:
             mod = getattr(__import__('sqlalchemy.databases.%s' % name).databases, name)
index 3ed5ee1458c45995d7aa3489df0ce5c4487bfb73..1784af37f2deb47a8755bed687fe4423d822277e 100644 (file)
@@ -11,16 +11,14 @@ from sqlalchemy.test import *
 from sqlalchemy.sql.functions import GenericFunction
 from sqlalchemy.test.testing import eq_
 from decimal import Decimal as _python_Decimal
-
+from sqlalchemy.test import testing
 from sqlalchemy.databases import *
 
-# FIXME!
-dialects = [d for d in all_dialects() if d.name not in ('access', 'informix')]
-
 
 class CompileTest(TestBase, AssertsCompiledSQL):
+
     def test_compile(self):
-        for dialect in dialects:
+        for dialect in all_dialects(exclude=('sybase', 'access', 'informix', 'maxdb')):
             bindtemplate = BIND_TEMPLATES[dialect.paramstyle]
             self.assert_compile(func.current_timestamp(), "CURRENT_TIMESTAMP", dialect=dialect)
             self.assert_compile(func.localtime(), "LOCALTIME", dialect=dialect)
@@ -35,8 +33,12 @@ class CompileTest(TestBase, AssertsCompiledSQL):
 
                 def __init__(self, arg, **kwargs):
                     GenericFunction.__init__(self, args=[arg], **kwargs)
-                
-            self.assert_compile(fake_func('foo'), "fake_func(%s)" % bindtemplate % {'name':'param_1', 'position':1}, dialect=dialect)
+
+            self.assert_compile(
+                            fake_func('foo'), 
+                            "fake_func(%s)" % 
+                            bindtemplate % {'name':'param_1', 'position':1}, 
+                            dialect=dialect)
             
     def test_use_labels(self):
         self.assert_compile(select([func.foo()], use_labels=True), 
@@ -99,11 +101,13 @@ class CompileTest(TestBase, AssertsCompiledSQL):
         
         for fn in [func.coalesce, func.max, func.min, func.sum]:
             for args, type_ in [
-                            ((datetime.date(2007, 10, 5), datetime.date(2005, 10, 15)), sqltypes.Date),
+                            ((datetime.date(2007, 10, 5), 
+                                datetime.date(2005, 10, 15)), sqltypes.Date),
                             ((3, 5), sqltypes.Integer),
                             ((_python_Decimal(3), _python_Decimal(5)), sqltypes.Numeric),
                             (("foo", "bar"), sqltypes.String),
-                            ((datetime.datetime(2007, 10, 5, 8, 3, 34), datetime.datetime(2005, 10, 15, 14, 45, 33)), sqltypes.DateTime)
+                            ((datetime.datetime(2007, 10, 5, 8, 3, 34), 
+                                datetime.datetime(2005, 10, 15, 14, 45, 33)), sqltypes.DateTime)
                         ]:
                 assert isinstance(fn(*args).type, type_), "%s / %s" % (fn(), type_)
         
@@ -141,10 +145,13 @@ class CompileTest(TestBase, AssertsCompiledSQL):
         self.assert_compile(func.lala.hoho(7), "lala.hoho(:hoho_1)")
 
         # test None becomes NULL
-        self.assert_compile(func.my_func(1,2,None,3), "my_func(:my_func_1, :my_func_2, NULL, :my_func_3)")
+        self.assert_compile(func.my_func(1,2,None,3), 
+                        "my_func(:my_func_1, :my_func_2, NULL, :my_func_3)")
 
         # test pickling
-        self.assert_compile(util.pickle.loads(util.pickle.dumps(func.my_func(1, 2, None, 3))), "my_func(:my_func_1, :my_func_2, NULL, :my_func_3)")
+        self.assert_compile(
+                util.pickle.loads(util.pickle.dumps(func.my_func(1, 2, None, 3))),
+                "my_func(:my_func_1, :my_func_2, NULL, :my_func_3)")
 
         # assert func raises AttributeError for __bases__ attribute, since its not a class
         # fixes pydoc
@@ -269,7 +276,8 @@ class ExecuteTest(TestBase):
             eq_(res, [(-14, 'hi'), (3, None), (7, None)])
 
             t2.update(values=dict(value=func.length("asdsafasd"))).execute(stuff="some stuff")
-            assert select([t2.c.value, t2.c.stuff]).execute().fetchall() == [(9,"some stuff"), (9,"some stuff"), (9,"some stuff")]
+            assert select([t2.c.value, t2.c.stuff]).execute().fetchall() == \
+                        [(9,"some stuff"), (9,"some stuff"), (9,"some stuff")]
 
             t2.delete().execute()