Thread: [SQL-CVS] r4630 - in SQLObject/trunk: docs sqlobject/inheritance/tests sqlobject/tests
SQLObject is a Python ORM.
Brought to you by:
ianbicking,
phd
From: <sub...@co...> - 2013-08-11 17:13:53
|
Author: phd Date: Sun Aug 11 11:13:47 2013 New Revision: 4630 Log: Merged revisions 4628, 4629 from branch 1.5: a number of fixes for tests Modified: SQLObject/trunk/docs/News.txt SQLObject/trunk/sqlobject/inheritance/tests/test_asdict.py SQLObject/trunk/sqlobject/tests/test_basic.py SQLObject/trunk/sqlobject/tests/test_sqlobject_admin.py SQLObject/trunk/sqlobject/tests/test_transactions.py Modified: SQLObject/trunk/docs/News.txt ============================================================================== --- SQLObject/trunk/docs/News.txt Sun Aug 11 11:10:32 2013 (r4629) +++ SQLObject/trunk/docs/News.txt Sun Aug 11 11:13:47 2013 (r4630) @@ -19,6 +19,11 @@ * Helpers for class Outer were changed to lookup columns in table's declarations. +Minor features +-------------- + +* A number of fixes for tests. + Bugfixes -------- Modified: SQLObject/trunk/sqlobject/inheritance/tests/test_asdict.py ============================================================================== --- SQLObject/trunk/sqlobject/inheritance/tests/test_asdict.py Sun Aug 11 11:10:32 2013 (r4629) +++ SQLObject/trunk/sqlobject/inheritance/tests/test_asdict.py Sun Aug 11 11:13:47 2013 (r4630) @@ -6,37 +6,37 @@ ## sqlmeta.asDict ######################################## -class InheritablePerson(InheritableSQLObject): - first = StringCol() - last = StringCol(alternateID=True, length=255) +class InheritablePersonAD(InheritableSQLObject): + firstName = StringCol() + lastName = StringCol(alternateID=True, length=255) -class Boss(InheritablePerson): +class ManagerAD(InheritablePersonAD): department = StringCol() -class Employee(InheritablePerson): +class Employee(InheritablePersonAD): _inheritable = False position = StringCol() def test_getColumns(): - setupClass([InheritablePerson, Boss, Employee]) + setupClass([InheritablePersonAD, ManagerAD, Employee]) for klass, columns in ( - (InheritablePerson, ['first', 'last']), - (Boss, ['department', 'first', 'last']), - (Employee, ['first', 'last', 'position'])): + (InheritablePersonAD, ['firstName', 'lastName']), + (ManagerAD, ['department', 'firstName', 'lastName']), + (Employee, ['firstName', 'lastName', 'position'])): _columns = klass.sqlmeta.getColumns().keys() _columns.sort() assert _columns == columns def test_asDict(): - setupClass([InheritablePerson, Boss, Employee]) - InheritablePerson(first='Oneof', last='Authors') - Boss(first='Boss', last='The', department='Dep') - Employee(first='Project', last='Leader', position='Project leader') - - assert InheritablePerson.get(1).sqlmeta.asDict() == \ - dict(first='Oneof', last='Authors', id=1) - assert InheritablePerson.get(2).sqlmeta.asDict() == \ - dict(first='Boss', last='The', department='Dep', id=2) - assert InheritablePerson.get(3).sqlmeta.asDict() == \ - dict(first='Project', last='Leader', position='Project leader', id=3) + setupClass([InheritablePersonAD, ManagerAD, Employee]) + InheritablePersonAD(firstName='Oneof', lastName='Authors') + ManagerAD(firstName='ManagerAD', lastName='The', department='Dep') + Employee(firstName='Project', lastName='Leader', position='Project leader') + + assert InheritablePersonAD.get(1).sqlmeta.asDict() == \ + dict(firstName='Oneof', lastName='Authors', id=1) + assert InheritablePersonAD.get(2).sqlmeta.asDict() == \ + dict(firstName='ManagerAD', lastName='The', department='Dep', id=2) + assert InheritablePersonAD.get(3).sqlmeta.asDict() == \ + dict(firstName='Project', lastName='Leader', position='Project leader', id=3) Modified: SQLObject/trunk/sqlobject/tests/test_basic.py ============================================================================== --- SQLObject/trunk/sqlobject/tests/test_basic.py Sun Aug 11 11:10:32 2013 (r4629) +++ SQLObject/trunk/sqlobject/tests/test_basic.py Sun Aug 11 11:13:47 2013 (r4630) @@ -305,3 +305,4 @@ class TestSO13(SQLObject): _connection = connectionForURI('sqlite:///db2') assert TestSO13._connection.uri() == 'sqlite:///db2' + del sqlhub.processConnection Modified: SQLObject/trunk/sqlobject/tests/test_sqlobject_admin.py ============================================================================== --- SQLObject/trunk/sqlobject/tests/test_sqlobject_admin.py Sun Aug 11 11:10:32 2013 (r4629) +++ SQLObject/trunk/sqlobject/tests/test_sqlobject_admin.py Sun Aug 11 11:13:47 2013 (r4630) @@ -4,8 +4,6 @@ from sqlobject import * -sqlhub.processConnection = connectionForURI('postgres://pgsql@/db_test') - class Test1(SQLObject): class sqlmeta: createSQL = "CREATE SEQUENCE db_test1_seq;" Modified: SQLObject/trunk/sqlobject/tests/test_transactions.py ============================================================================== --- SQLObject/trunk/sqlobject/tests/test_transactions.py Sun Aug 11 11:10:32 2013 (r4629) +++ SQLObject/trunk/sqlobject/tests/test_transactions.py Sun Aug 11 11:13:47 2013 (r4630) @@ -56,7 +56,10 @@ if not supports('transactions'): return setupClass(TestSOTrans) - trans = TestSOTrans._connection.transaction() + connection = TestSOTrans._connection + if (connection.dbName == 'sqlite') and connection._memory: + return # The following test requires a different connection + trans = connection.transaction() try: TestSOTrans(name='bob') bIn = TestSOTrans.byName('bob', connection=trans) @@ -71,7 +74,7 @@ raises(SQLObjectNotFound, "bOutInst.name") finally: trans.rollback() - TestSOTrans._connection.autoCommit = True + connection.autoCommit = True def test_transaction_delete_with_close(): test_transaction_delete(close=True) |