Problem with using unittest module

Olivier Langlois olanglois at sympatico.ca
Mon Jul 31 13:23:12 EDT 2006


Hi,

I have the following statement in my test :

self.assertRaises(CDKeyException, ValidationObject.Validate,
1001,'NonExistantKey')

and the test fails as if assertRaises was not catching the thrown
exception:

======================================================================
ERROR: test (DBLookupValidationTests.DBLookupValidationTests)
----------------------------------------------------------------------
Traceback (most recent call last):
  File
"C:\Dev\jade.r12sp\src\RVPackages\CDKey\Server\DBLookupValidationTests.py",
line 64, in test
    self.assertRaises(CDKeyException, ValidationObject.Validate,
1001,'NonExistantKey')
  File "C:\tools\Python\lib\unittest.py", line 320, in failUnlessRaises
    callableObj(*args, **kwargs)
  File
"C:\Dev\jade.r12sp\src/Services/local/Home\Scripts/system\CDKey\DBLookupValidation.py",
line 69, in Validate
    raise CDKeyException, self.logger.error(e) CDKeyException

Any idea what is happening?

Thanks,
Olivier Langlois
http://www.olivierlanglois.net




More information about the Python-list mailing list