- marked as
- changed title to unit tests need database-specific qualifiers
unit tests need database-specific qualifiers
Issue #159
resolved
A user has run the unit tests and is confused that many of them fail when running with the default SQLite database. in theory it would be nice for every single unit test to check against the current database engine and to not run if it is known that the engine does not support a given operation.
(omitting unit test output, descriptions follow)
Comments (2)
-
repo owner -
repo owner - changed status to resolved
the decorator approach has been implemented in changeset:1357 and qualifiers have been set up for mysql, postgres and sqlite, and some oracle so far. new qualifiers can be added as:
@testbase.supported('postgres', 'oracle') def mytest(self): .... @testbase.unsupported('sqlite', 'mysql') def myothertest(self): ....
- Log in to comment
the unittests are designed to be run with all supported databases, which is selected via the "--db" flag, such as:
or with a url such as:
as such, not every unit test works with every database. this is by design, as SQLAlchemy is not trying to distill every database into a common "virtual" database; it has many features that are only going to work on certain platforms, such as sequences, nested transactions, etc.
Also, it is not assumed that the test site has all databases and drivers installed, which is why the unittest suite runs with mostly only the specified database driver.
ERROR: testbinary (testtypes.BinaryTest?)
this test uses the compiled .pyc file as a binary file to save. it will fail on the first compile and then works from a local directory (probably not from an egg install)
testsequence (defaults.SequenceTest?) teststandalone2 (defaults.SequenceTest?)
these tests only pass on Postgres and Oracle which have sequences.
testprimarykey (objectstore.PKTest)
this test doesnt work on SQLite which has poor support for composite primary keys
ERROR: tests creating a new Session inside a database transaction, in
this test is actually documented that SQLite will raise an error, as it does not support nested sessions.
ERROR: testbackref (inheritance.InheritTest5)
this test was added in support of a known bug, so this is a duplicate of
#154testcast (select.SelectTest?)
this bug was fixed as of 1280, make sure you have your PYTHONPATH set FAIL: teststandalone (defaults.SequenceTest?)
sequences, again only postgres/oracle