Author: phd
Date: Wed Aug 14 09:15:14 2013
New Revision: 4635
Log:
Another couple of test fixes by Neil Muller
sqlobject/tests/test_schema.py: clear schema so later tests don't fail.
sqlobject/tests/test_transactions.py: close connection. Without this,
test_unicode fails if part of the same run.
sqlobject/inheritance/tests/test_deep_inheritance.py: close connection. Without
this, several tests (such as test_schema) fail if included in the same run.
sqlobject/inheritance/tests/test_foreignKey.py: force recreating tables to
prevent problems on subsequent runs with the same database.
sqlobject/tests/dbtest.py, sqlobject/tests/test_cyclic_reference.py: skip the
test on MySQL because it doesn't support 'DROP TABLE .. CASCADE.
Modified:
SQLObject/branches/1.5/sqlobject/inheritance/tests/test_asdict.py
SQLObject/branches/1.5/sqlobject/inheritance/tests/test_deep_inheritance.py
SQLObject/branches/1.5/sqlobject/inheritance/tests/test_foreignKey.py
SQLObject/branches/1.5/sqlobject/tests/dbtest.py
SQLObject/branches/1.5/sqlobject/tests/test_cyclic_reference.py
SQLObject/branches/1.5/sqlobject/tests/test_schema.py
SQLObject/branches/1.5/sqlobject/tests/test_transactions.py
Modified: SQLObject/branches/1.5/sqlobject/inheritance/tests/test_asdict.py
==============================================================================
--- SQLObject/branches/1.5/sqlobject/inheritance/tests/test_asdict.py Mon Aug 12 08:22:56 2013 (r4634)
+++ SQLObject/branches/1.5/sqlobject/inheritance/tests/test_asdict.py Wed Aug 14 09:15:14 2013 (r4635)
@@ -29,7 +29,7 @@
assert _columns == columns
def test_asDict():
- setupClass([InheritablePersonAD, ManagerAD, EmployeeAD])
+ setupClass([InheritablePersonAD, ManagerAD, EmployeeAD], force=True)
InheritablePersonAD(firstName='Oneof', lastName='Authors')
ManagerAD(firstName='ManagerAD', lastName='The', department='Dep')
EmployeeAD(firstName='Project', lastName='Leader', position='Project leader')
Modified: SQLObject/branches/1.5/sqlobject/inheritance/tests/test_deep_inheritance.py
==============================================================================
--- SQLObject/branches/1.5/sqlobject/inheritance/tests/test_deep_inheritance.py Mon Aug 12 08:22:56 2013 (r4634)
+++ SQLObject/branches/1.5/sqlobject/inheritance/tests/test_deep_inheritance.py Wed Aug 14 09:15:14 2013 (r4635)
@@ -72,7 +72,8 @@
person_id = DIPerson(firstName='Oneof', lastName='Authors',
manager=manager).id
- cache = getConnection().cache
+ conn = getConnection()
+ cache = conn.cache
cache.clear()
managers = list(DIManager.select())
@@ -97,3 +98,4 @@
person = DIEmployee.get(manager_id)
assert isinstance(person, DIManager)
+ conn.close()
Modified: SQLObject/branches/1.5/sqlobject/inheritance/tests/test_foreignKey.py
==============================================================================
--- SQLObject/branches/1.5/sqlobject/inheritance/tests/test_foreignKey.py Mon Aug 12 08:22:56 2013 (r4634)
+++ SQLObject/branches/1.5/sqlobject/inheritance/tests/test_foreignKey.py Wed Aug 14 09:15:14 2013 (r4635)
@@ -19,7 +19,7 @@
paper = ForeignKey("Paper", default=None)
def test_foreignKey():
- setupClass([Note, PersonWithNotes, Paper, EmployeeWithNotes])
+ setupClass([Note, PersonWithNotes, Paper, EmployeeWithNotes], force=True)
note = Note(text="person")
PersonWithNotes(firstName='Oneof', lastName='Authors', note=note)
Modified: SQLObject/branches/1.5/sqlobject/tests/dbtest.py
==============================================================================
--- SQLObject/branches/1.5/sqlobject/tests/dbtest.py Mon Aug 12 08:22:56 2013 (r4634)
+++ SQLObject/branches/1.5/sqlobject/tests/dbtest.py Wed Aug 14 09:15:14 2013 (r4635)
@@ -40,7 +40,7 @@
supportsMatrix = {
'+exceptions': 'mysql postgres sqlite',
'-transactions': 'mysql rdbhost',
- '-dropTableCascade': 'sybase mssql',
+ '-dropTableCascade': 'sybase mssql mysql',
'-expressionIndex': 'mysql sqlite firebird mssql',
'-blobData': 'mssql rdbhost',
'-decimalColumn': 'mssql',
Modified: SQLObject/branches/1.5/sqlobject/tests/test_cyclic_reference.py
==============================================================================
--- SQLObject/branches/1.5/sqlobject/tests/test_cyclic_reference.py Mon Aug 12 08:22:56 2013 (r4634)
+++ SQLObject/branches/1.5/sqlobject/tests/test_cyclic_reference.py Wed Aug 14 09:15:14 2013 (r4635)
@@ -24,6 +24,8 @@
fkeya = ForeignKey('TestCyclicReferenceA')
def test_cyclic_reference():
+ if not supports('dropTableCascade'):
+ return
conn = getConnection()
TestCyclicReferenceA.setConnection(conn)
TestCyclicReferenceB.setConnection(conn)
Modified: SQLObject/branches/1.5/sqlobject/tests/test_schema.py
==============================================================================
--- SQLObject/branches/1.5/sqlobject/tests/test_schema.py Mon Aug 12 08:22:56 2013 (r4634)
+++ SQLObject/branches/1.5/sqlobject/tests/test_schema.py Wed Aug 14 09:15:14 2013 (r4635)
@@ -19,3 +19,5 @@
setupClass(Test)
Test(foo='bar')
assert conn.queryAll("SELECT * FROM test.test")
+ conn.schema = None
+ conn.query('SET search_path TO public')
Modified: SQLObject/branches/1.5/sqlobject/tests/test_transactions.py
==============================================================================
--- SQLObject/branches/1.5/sqlobject/tests/test_transactions.py Mon Aug 12 08:22:56 2013 (r4634)
+++ SQLObject/branches/1.5/sqlobject/tests/test_transactions.py Wed Aug 14 09:15:14 2013 (r4635)
@@ -75,6 +75,7 @@
finally:
trans.rollback()
connection.autoCommit = True
+ connection.close()
def test_transaction_delete_with_close():
test_transaction_delete(close=True)
|