still not happy with unittest.failUnlessRaises

paul koelle paul at subsignal.org
Sat Oct 9 17:24:03 CEST 2004


hi folks,

while I got my own errors kind of sorted out now (I think), unittest
still not behaves like it should.

code:
print 'this is expected to fail. The "Type" column is unique in the DB'
self.failUnlessRaises(IntegrityError, self.failhelper(certs.Subcacert,
self.ca_client_tmpl))

traceback:
File "/usr/lib/python2.2/site-packages/SQLObject/DBConnection.py", line
767, in _queryInsertID  c.execute(q)
File "/usr/lib/python2.2/site-packages/sqlite/main.py", line 243, in
execute self.rs = self.con.db.execute(SQL)
IntegrityError: column type is not unique

----------------------------------------------------------------------
Ran 1 test in 56.245s

FAILED (errors=1)

the docu (2.2) says:
failUnlessRaises( exception, callable, ...)
...The test passes if exception is raised, is an error if another
exception is raised, or fails if no exception is raised.

and:
issubclass(sqlite.IntegrityError, Exception)
True

IMO the test should pass. Any ideas what could be wrong here?

thanks
  Paul



More information about the Python-list mailing list