Warning: Can't synchronize with repository "(default)" (Unsupported version control system "svn": No module named svn). Look in the Trac log for more information.

Ticket #672 (closed defect: fixed)

Opened 13 years ago

Last modified 12 years ago

can't unit-test a model that uses inheritance

Reported by: roger@… Owned by: anonymous
Priority: normal Milestone: 0.9a2
Component: TurboGears Version:
Severity: normal Keywords: nosetests inheritance
Cc:

Description

In TurboGears 0.9a1 (which version is not selectable in trac, btw), nosetests will run the unit tests for a project that doesn't use inheritance. As soon as you add this line to model.py:

    from sqlobject.inheritance import InheritableSQLObject

SQLObject raises an exception:

Traceback (most recent call last):
  File
"/usr/local/lib/python2.4/site-packages/TurboGears-0.9a1-py2.4.egg/turbogears/testutil.py",
line 73, in setUp
    item.createTable(ifNotExists=True)
  File
"/usr/local/lib/python2.4/site-packages/SQLObject-0.7.1dev_r1588-py2.4.egg/sqlobject/main.py",
line 1319, in createTable
    conn = connection or cls._connection
  File
"/usr/local/lib/python2.4/site-packages/SQLObject-0.7.1dev_r1588-py2.4.egg/sqlobject/dbconnection.py",
line 881, in __get__
    return self.getConnection()
  File
"/usr/local/lib/python2.4/site-packages/SQLObject-0.7.1dev_r1588-py2.4.egg/sqlobject/dbconnection.py",
line 893, in getConnection
    raise AttributeError(
AttributeError: No connection has been defined for this thread or
process

Note that this occurs even without actually using inheritance in the model; just importing InheritableSQLObject is enough to trigger it.

I'm reporting this against the "TurboGears" component because I believe it's in the testutil code.

This means that TurboGears does not presently support unit testing of a model that uses inheritance.

Change History

comment:1 Changed 13 years ago by kevin

  • Status changed from new to closed
  • Resolution set to fixed

Fixed in [1004].

Note: See TracTickets for help on using tickets.