1. lecstor
  2. sqlalchemy

Commits

Mike Bayer  committed ff255b3

make it more explicit in tests which dialect we want to use for things

  • Participants
  • Parent commits a42fc1a
  • Branches default

Comments (0)

Files changed (12)

File test/dialect/test_postgresql.py

View file
     def test_expression_pyformat(self):
         self.assert_compile(matchtable.c.title.match('somstr'),
                             'matchtable.title @@ to_tsquery(%(title_1)s'
-                            ')',
-                            dialect=postgresql.dialect())
+                            ')')
 
     @testing.fails_on('postgresql+psycopg2', 'uses pyformat')
     @testing.fails_on('postgresql+pypostgresql', 'uses pyformat')
     @testing.fails_on('postgresql+zxjdbc', 'uses qmark')
     def test_expression_positional(self):
         self.assert_compile(matchtable.c.title.match('somstr'),
-                            'matchtable.title @@ to_tsquery(%s)',
-                            dialect=postgresql.dialect())
+                            'matchtable.title @@ to_tsquery(%s)')
 
     def test_simple_match(self):
         results = \

File test/engine/test_reflection.py

View file
 
 
 class ReverseCasingReflectTest(TestBase, AssertsCompiledSQL):
+    __dialect__ = 'default'
 
     @testing.requires.denormalized_names
     def setup(self):

File test/ext/test_compiler.py

View file
 from test.lib import *
 
 class UserDefinedTest(TestBase, AssertsCompiledSQL):
+    __dialect__ = 'default'
 
     def test_column(self):
 
 
 class DefaultOnExistingTest(TestBase, AssertsCompiledSQL):
     """Test replacement of default compilation on existing constructs."""
+    __dialect__ = 'default'
 
     def teardown(self):
         for cls in (Select, _BindParamClause):

File test/ext/test_hybrid.py

View file
 from test.lib.testing import TestBase, eq_, AssertsCompiledSQL
 
 class PropertyComparatorTest(TestBase, AssertsCompiledSQL):
+    __dialect__ = 'default'
 
     def _fixture(self):
         Base = declarative_base()
         )
 
 class PropertyExpressionTest(TestBase, AssertsCompiledSQL):
+    __dialect__ = 'default'
     def _fixture(self):
         Base = declarative_base()
 
         )
 
 class PropertyValueTest(TestBase, AssertsCompiledSQL):
+    __dialect__ = 'default'
     def _fixture(self):
         Base = declarative_base()
 
         eq_(a1._value, 10)
 
 class MethodExpressionTest(TestBase, AssertsCompiledSQL):
+    __dialect__ = 'default'
     def _fixture(self):
         Base = declarative_base()
 

File test/lib/testing.py

View file
 class AssertsCompiledSQL(object):
     def assert_compile(self, clause, result, params=None, 
                         checkparams=None, dialect=None, 
-                        use_default_dialect=False):
+                        use_default_dialect=False,
+                        allow_dialect_select=False):
+
         if use_default_dialect:
             dialect = default.DefaultDialect()
-
-        if dialect is None:
+        elif dialect == None and not allow_dialect_select:
             dialect = getattr(self, '__dialect__', None)
+            if dialect == 'default':
+                dialect = default.DefaultDialect()
+            elif dialect is None:
+                dialect = db.dialect
 
         kw = {}
         if params is not None:

File test/sql/test_case_statement.py

View file
 
 
 class CaseTest(TestBase, AssertsCompiledSQL):
+    __dialect__ = 'default'
 
     @classmethod
     def setup_class(cls):

File test/sql/test_compiler.py

View file
 )
 
 class SelectTest(TestBase, AssertsCompiledSQL):
+    __dialect__ = 'default'
 
     def test_attribute_sanity(self):
         assert hasattr(table1, 'c')
 
 
 class CRUDTest(TestBase, AssertsCompiledSQL):
+    __dialect__ = 'default'
+
     def test_insert(self):
         # generic insert, will create bind params for all columns
         self.assert_compile(insert(table1), 
         )
 
 class InlineDefaultTest(TestBase, AssertsCompiledSQL):
+    __dialect__ = 'default'
+
     def test_insert(self):
         m = MetaData()
         foo =  Table('foo', m,
                         "col3=:col3")
 
 class SchemaTest(TestBase, AssertsCompiledSQL):
+    __dialect__ = 'default'
+
     def test_select(self):
         self.assert_compile(table4.select(), 
                 "SELECT remote_owner.remotetable.rem_id, remote_owner.remotetable.datatype_id,"

File test/sql/test_constraints.py

View file
         )
 
 class ConstraintCompilationTest(TestBase, AssertsCompiledSQL):
+    __dialect__ = 'default'
 
     def _test_deferrable(self, constraint_factory):
         t = Table('tbl', MetaData(),

File test/sql/test_functions.py

View file
 
 
 class CompileTest(TestBase, AssertsCompiledSQL):
+    __dialect__ = 'default'
 
     def test_compile(self):
         for dialect in all_dialects(exclude=('sybase', 'access', 'informix', 'maxdb')):

File test/sql/test_generative.py

View file
 class ClauseTest(TestBase, AssertsCompiledSQL):
     """test copy-in-place behavior of various ClauseElements."""
 
+    __dialect__ = 'default'
+
     @classmethod
     def setup_class(cls):
         global t1, t2
                             'anon_1.col1')
 
 class ClauseAdapterTest(TestBase, AssertsCompiledSQL):
+    __dialect__ = 'default'
+
     @classmethod
     def setup_class(cls):
         global t1, t2
         )
 
 class SpliceJoinsTest(TestBase, AssertsCompiledSQL):
+    __dialect__ = 'default'
+
     @classmethod
     def setup_class(cls):
         global table1, table2, table3, table4
 class SelectTest(TestBase, AssertsCompiledSQL):
     """tests the generative capability of Select"""
 
+    __dialect__ = 'default'
+
     @classmethod
     def setup_class(cls):
         global t1, t2
 class InsertTest(TestBase, AssertsCompiledSQL):
     """Tests the generative capability of Insert"""
 
+    __dialect__ = 'default'
+
     # fixme: consolidate converage from elsewhere here and expand
 
     @classmethod

File test/sql/test_quote.py

View file
 from test.lib import *
 
 class QuoteTest(TestBase, AssertsCompiledSQL):
+    __dialect__ = 'default'
+
     @classmethod
     def setup_class(cls):
         # TODO: figure out which databases/which identifiers allow special

File test/sql/test_types.py

View file
         return open(f, mode='rb').read()
 
 class ExpressionTest(TestBase, AssertsExecutionResults, AssertsCompiledSQL):
+    __dialect__ = 'default'
+
     @classmethod
     def setup_class(cls):
         global test_table, meta, MyCustomType, MyTypeDec
             (INTEGER(), "INTEGER"),
             (dialects.mysql.INTEGER(display_width=5), "INTEGER(5)")
         ):
-            self.assert_compile(type_, expected)
+            self.assert_compile(type_, expected,
+                                allow_dialect_select=True)
 
 class DateTest(TestBase, AssertsExecutionResults):
     @classmethod