diff options
| author | Mike Bayer <mike_mp@zzzcomputing.com> | 2011-02-11 11:24:54 -0500 |
|---|---|---|
| committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2011-02-11 11:24:54 -0500 |
| commit | 33eae4a1405b1968ad486bfe3aefee7f7d631128 (patch) | |
| tree | 326624218607f1f91ddcccdc61d83dec99251c15 | |
| parent | 09efc11fbc95f8a47200dd102d304b90609e9408 (diff) | |
| download | sqlalchemy-33eae4a1405b1968ad486bfe3aefee7f7d631128.tar.gz | |
make it more explicit in tests which dialect we want to use for things
| -rw-r--r-- | test/dialect/test_postgresql.py | 6 | ||||
| -rw-r--r-- | test/engine/test_reflection.py | 1 | ||||
| -rw-r--r-- | test/ext/test_compiler.py | 2 | ||||
| -rw-r--r-- | test/ext/test_hybrid.py | 4 | ||||
| -rw-r--r-- | test/lib/testing.py | 11 | ||||
| -rw-r--r-- | test/sql/test_case_statement.py | 1 | ||||
| -rw-r--r-- | test/sql/test_compiler.py | 7 | ||||
| -rw-r--r-- | test/sql/test_constraints.py | 1 | ||||
| -rw-r--r-- | test/sql/test_functions.py | 1 | ||||
| -rw-r--r-- | test/sql/test_generative.py | 10 | ||||
| -rw-r--r-- | test/sql/test_quote.py | 2 | ||||
| -rw-r--r-- | test/sql/test_types.py | 5 |
12 files changed, 43 insertions, 8 deletions
diff --git a/test/dialect/test_postgresql.py b/test/dialect/test_postgresql.py index 424e8b5d9..5d67e1921 100644 --- a/test/dialect/test_postgresql.py +++ b/test/dialect/test_postgresql.py @@ -2094,16 +2094,14 @@ class MatchTest(TestBase, AssertsCompiledSQL): 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 = \ diff --git a/test/engine/test_reflection.py b/test/engine/test_reflection.py index e23633802..a83c332cb 100644 --- a/test/engine/test_reflection.py +++ b/test/engine/test_reflection.py @@ -1133,6 +1133,7 @@ def _drop_views(con, schema=None): class ReverseCasingReflectTest(TestBase, AssertsCompiledSQL): + __dialect__ = 'default' @testing.requires.denormalized_names def setup(self): diff --git a/test/ext/test_compiler.py b/test/ext/test_compiler.py index 116b0f229..eaa46cc28 100644 --- a/test/ext/test_compiler.py +++ b/test/ext/test_compiler.py @@ -10,6 +10,7 @@ from sqlalchemy.sql import table, column, visitors from test.lib import * class UserDefinedTest(TestBase, AssertsCompiledSQL): + __dialect__ = 'default' def test_column(self): @@ -266,6 +267,7 @@ class UserDefinedTest(TestBase, AssertsCompiledSQL): class DefaultOnExistingTest(TestBase, AssertsCompiledSQL): """Test replacement of default compilation on existing constructs.""" + __dialect__ = 'default' def teardown(self): for cls in (Select, _BindParamClause): diff --git a/test/ext/test_hybrid.py b/test/ext/test_hybrid.py index 201d3821f..cab1c90bb 100644 --- a/test/ext/test_hybrid.py +++ b/test/ext/test_hybrid.py @@ -6,6 +6,7 @@ from sqlalchemy.ext import hybrid from test.lib.testing import TestBase, eq_, AssertsCompiledSQL class PropertyComparatorTest(TestBase, AssertsCompiledSQL): + __dialect__ = 'default' def _fixture(self): Base = declarative_base() @@ -77,6 +78,7 @@ class PropertyComparatorTest(TestBase, AssertsCompiledSQL): ) class PropertyExpressionTest(TestBase, AssertsCompiledSQL): + __dialect__ = 'default' def _fixture(self): Base = declarative_base() @@ -142,6 +144,7 @@ class PropertyExpressionTest(TestBase, AssertsCompiledSQL): ) class PropertyValueTest(TestBase, AssertsCompiledSQL): + __dialect__ = 'default' def _fixture(self): Base = declarative_base() @@ -167,6 +170,7 @@ class PropertyValueTest(TestBase, AssertsCompiledSQL): eq_(a1._value, 10) class MethodExpressionTest(TestBase, AssertsCompiledSQL): + __dialect__ = 'default' def _fixture(self): Base = declarative_base() diff --git a/test/lib/testing.py b/test/lib/testing.py index 36a8c8d1a..bf852de7c 100644 --- a/test/lib/testing.py +++ b/test/lib/testing.py @@ -628,12 +628,17 @@ class TestBase(object): 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: diff --git a/test/sql/test_case_statement.py b/test/sql/test_case_statement.py index 97220d4dd..4bb9cf0fc 100644 --- a/test/sql/test_case_statement.py +++ b/test/sql/test_case_statement.py @@ -7,6 +7,7 @@ from sqlalchemy.sql import table, column class CaseTest(TestBase, AssertsCompiledSQL): + __dialect__ = 'default' @classmethod def setup_class(cls): diff --git a/test/sql/test_compiler.py b/test/sql/test_compiler.py index 4ede56320..b060fef5b 100644 --- a/test/sql/test_compiler.py +++ b/test/sql/test_compiler.py @@ -62,6 +62,7 @@ addresses = table('addresses', ) class SelectTest(TestBase, AssertsCompiledSQL): + __dialect__ = 'default' def test_attribute_sanity(self): assert hasattr(table1, 'c') @@ -2417,6 +2418,8 @@ class SelectTest(TestBase, AssertsCompiledSQL): class CRUDTest(TestBase, AssertsCompiledSQL): + __dialect__ = 'default' + def test_insert(self): # generic insert, will create bind params for all columns self.assert_compile(insert(table1), @@ -2671,6 +2674,8 @@ class CRUDTest(TestBase, AssertsCompiledSQL): ) class InlineDefaultTest(TestBase, AssertsCompiledSQL): + __dialect__ = 'default' + def test_insert(self): m = MetaData() foo = Table('foo', m, @@ -2703,6 +2708,8 @@ class InlineDefaultTest(TestBase, AssertsCompiledSQL): "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," diff --git a/test/sql/test_constraints.py b/test/sql/test_constraints.py index f4791c0bd..1c13a0ec7 100644 --- a/test/sql/test_constraints.py +++ b/test/sql/test_constraints.py @@ -256,6 +256,7 @@ class ConstraintTest(TestBase, AssertsExecutionResults, AssertsCompiledSQL): ) class ConstraintCompilationTest(TestBase, AssertsCompiledSQL): + __dialect__ = 'default' def _test_deferrable(self, constraint_factory): t = Table('tbl', MetaData(), diff --git a/test/sql/test_functions.py b/test/sql/test_functions.py index b0106b21b..98d8d7a97 100644 --- a/test/sql/test_functions.py +++ b/test/sql/test_functions.py @@ -16,6 +16,7 @@ from sqlalchemy.databases import * class CompileTest(TestBase, AssertsCompiledSQL): + __dialect__ = 'default' def test_compile(self): for dialect in all_dialects(exclude=('sybase', 'access', 'informix', 'maxdb')): diff --git a/test/sql/test_generative.py b/test/sql/test_generative.py index c6f5dc05e..088162c8a 100644 --- a/test/sql/test_generative.py +++ b/test/sql/test_generative.py @@ -169,6 +169,8 @@ class TraversalTest(TestBase, AssertsExecutionResults): class ClauseTest(TestBase, AssertsCompiledSQL): """test copy-in-place behavior of various ClauseElements.""" + __dialect__ = 'default' + @classmethod def setup_class(cls): global t1, t2 @@ -471,6 +473,8 @@ class ClauseTest(TestBase, AssertsCompiledSQL): 'anon_1.col1') class ClauseAdapterTest(TestBase, AssertsCompiledSQL): + __dialect__ = 'default' + @classmethod def setup_class(cls): global t1, t2 @@ -858,6 +862,8 @@ class ClauseAdapterTest(TestBase, AssertsCompiledSQL): ) class SpliceJoinsTest(TestBase, AssertsCompiledSQL): + __dialect__ = 'default' + @classmethod def setup_class(cls): global table1, table2, table3, table4 @@ -929,6 +935,8 @@ class SpliceJoinsTest(TestBase, AssertsCompiledSQL): class SelectTest(TestBase, AssertsCompiledSQL): """tests the generative capability of Select""" + __dialect__ = 'default' + @classmethod def setup_class(cls): global t1, t2 @@ -1083,6 +1091,8 @@ class SelectTest(TestBase, AssertsCompiledSQL): class InsertTest(TestBase, AssertsCompiledSQL): """Tests the generative capability of Insert""" + __dialect__ = 'default' + # fixme: consolidate converage from elsewhere here and expand @classmethod diff --git a/test/sql/test_quote.py b/test/sql/test_quote.py index 2aa5086c6..50adad751 100644 --- a/test/sql/test_quote.py +++ b/test/sql/test_quote.py @@ -4,6 +4,8 @@ from sqlalchemy.sql import compiler from test.lib import * class QuoteTest(TestBase, AssertsCompiledSQL): + __dialect__ = 'default' + @classmethod def setup_class(cls): # TODO: figure out which databases/which identifiers allow special diff --git a/test/sql/test_types.py b/test/sql/test_types.py index 52db03d76..226283195 100644 --- a/test/sql/test_types.py +++ b/test/sql/test_types.py @@ -873,6 +873,8 @@ class BinaryTest(TestBase, AssertsExecutionResults): return open(f, mode='rb').read() class ExpressionTest(TestBase, AssertsExecutionResults, AssertsCompiledSQL): + __dialect__ = 'default' + @classmethod def setup_class(cls): global test_table, meta, MyCustomType, MyTypeDec @@ -1153,7 +1155,8 @@ class CompileTest(TestBase, AssertsCompiledSQL): (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 |
