On 8/4/06, Alberto Valverde <[EMAIL PROTECTED]> wrote:

On Aug 4, 2006, at 7:46 AM, Jorge Vargas wrote:

Hi, if using a unittest.TestCase subclass for your tests (like TG's DBTest) you can use the failUnlessRaises method.

class TestMyApp(TestCase):
def test_int(self):
""" test that int("a") raises a ValueError """ 
self.failUnlessRaises(ValueError, int, "a")
# As in your example:
def test_create(self):
self.failUnlessRaises(NotImplementedError, source.create)

I saw a couple of examples like that but I wanted to use nose-style tests for everything. I guess I'll have to use plain old TestCase classes.


maybe nose should implemente a set of module level functions that mimic the TestCase methods, I'll look around their trac to open a ticket/submit a patch.


but for now I'll use your approach alberto, thanks.


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "TurboGears" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/turbogears
-~----------~----~----~----~------~----~------~--~---

Reply via email to