diff options
author | Jason Kirtland <jek@discorporate.us> | 2007-12-13 09:59:14 +0000 |
---|---|---|
committer | Jason Kirtland <jek@discorporate.us> | 2007-12-13 09:59:14 +0000 |
commit | 8128a6378affeff76b573b1b4ca1e05e7d00b021 (patch) | |
tree | b0d20234152eb56026d509ea4b205ed086bc742a /test/sql/functions.py | |
parent | 2522534311452325513606d765ae398ce8514e2c (diff) | |
download | sqlalchemy-8128a6378affeff76b573b1b4ca1e05e7d00b021.tar.gz |
- Removed @testing.supported. Dialects in development or maintained outside
the tree can now run the full suite of tests out of the box.
- Migrated most @supported to @fails_on, @fails_on_everything_but, or (last
resort) @unsupported. @fails_on revealed a slew of bogus test skippage,
which was corrected.
- Added @fails_on_everything_but. Yes, the first usage *was*
"fails_on_everything_but('postgres')". How did you guess!
- Migrated @supported in dialect/* to the new test-class attribute __only_on__.
- Test classes can also have __unsupported_on__ and __excluded_on__.
Diffstat (limited to 'test/sql/functions.py')
-rw-r--r-- | test/sql/functions.py | 29 |
1 files changed, 18 insertions, 11 deletions
diff --git a/test/sql/functions.py b/test/sql/functions.py index 177a308b4..1103245ea 100644 --- a/test/sql/functions.py +++ b/test/sql/functions.py @@ -1,15 +1,24 @@ import testbase import datetime from sqlalchemy import * -from sqlalchemy import exceptions, sql +from sqlalchemy import databases, exceptions, sql from sqlalchemy.sql.compiler import BIND_TEMPLATES from sqlalchemy.engine import default from sqlalchemy import types as sqltypes from testlib import * -# TODO: add a helper function to testlib for this -from sqlalchemy.databases import sqlite, postgres, mysql, oracle, firebird, mssql -dialects = [x.dialect() for x in [sqlite, postgres, mysql, oracle, firebird, mssql]] +from sqlalchemy.databases import * +# every dialect in databases.__all__ is expected to pass these tests. +dialects = [getattr(databases, mod).dialect() + for mod in databases.__all__ + # fixme! + if mod not in ('access',)] + +# if the configured dialect is out-of-tree or not yet in __all__, include it +# too. +if testbase.db.name not in databases.__all__: + dialects.append(testbase.db.dialect) + class CompileTest(SQLCompileTest): def test_compile(self): @@ -22,7 +31,7 @@ class CompileTest(SQLCompileTest): else: self.assert_compile(func.nosuchfunction(), "nosuchfunction()", dialect=dialect) self.assert_compile(func.char_length('foo'), "char_length(%s)" % bindtemplate % {'name':'param_1', 'position':1}, dialect=dialect) - + def test_constructor(self): try: func.current_timestamp('somearg') @@ -41,14 +50,14 @@ class CompileTest(SQLCompileTest): assert False except TypeError: assert True - + def test_typing(self): assert isinstance(func.coalesce(datetime.date(2007, 10, 5), datetime.date(2005, 10, 15)).type, sqltypes.Date) assert isinstance(func.coalesce(None, datetime.date(2005, 10, 15)).type, sqltypes.Date) - + assert isinstance(func.concat("foo", "bar").type, sqltypes.String) - + class ExecuteTest(PersistTest): def test_standalone_execute(self): @@ -123,11 +132,10 @@ class ExecuteTest(PersistTest): t2.update(values={t2.c.value:func.length("asfdaasdf"), t2.c.stuff:"foo"}).execute() print "HI", select([t2.c.value, t2.c.stuff]).execute().fetchone() assert select([t2.c.value, t2.c.stuff]).execute().fetchone() == (9, "foo") - finally: meta.drop_all() - @testing.supported('postgres') + @testing.fails_on_everything_except('postgres') def test_as_from(self): # TODO: shouldnt this work on oracle too ? x = testbase.db.func.current_date().execute().scalar() @@ -150,4 +158,3 @@ def exec_sorted(statement, *args, **kw): if __name__ == '__main__': testbase.main() -
\ No newline at end of file |