Problem with using unittest module
Peter Otten
__peter__ at web.de
Mon Jul 31 14:16:56 EDT 2006
Olivier Langlois wrote:
> 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?
Just a guess: you might have defined a CDKeyException twice...
Peter
More information about the Python-list
mailing list