[TurboGears] Re: how to test for exceptions with nose?

2006-08-07 Thread Alberto Valverde
On Aug 5, 2006, at 3:16 AM, Jorge Vargas wrote: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

[TurboGears] Re: how to test for exceptions with nose?

2006-08-07 Thread Jorge Vargas
On 8/7/06, Alberto Valverde [EMAIL PROTECTED] wrote: Maybe the attached hack helps. Just make sure you don't keep it inside the path nosetests scans or it will spew a funky TypeError when trying to load the module when looking for tests in it. To use:from TestCaseMod import *test_foo():

[TurboGears] Re: how to test for exceptions with nose?

2006-08-05 Thread Jorge Vargas
On 8/5/06, Jorge Vargas [EMAIL PROTECTED] wrote: On 8/4/06, Kevin Dangoor [EMAIL PROTECTED] wrote: now that one does pass, but then if you have more then one exception to catch, they you will have to print out the exception name or something. I believe for now using Alberto's idea is better.

[TurboGears] Re: how to test for exceptions with nose?

2006-08-05 Thread Michele Cella
Jorge Vargas wrote: On 8/4/06, Kevin Dangoor [EMAIL PROTECTED] wrote: I'm not sure what you mean. That except clause up there will only handle ValueErrors. Anything else that comes up will error the test. (Not a failure, mind you, but it still wouldn't pass..) because even if it

[TurboGears] Re: how to test for exceptions with nose?

2006-08-05 Thread Jorge Vargas
On 8/5/06, Michele Cella [EMAIL PROTECTED] wrote: Jorge Vargas wrote: On 8/4/06, Kevin Dangoor [EMAIL PROTECTED] wrote:I'm not sure what you mean. That except clause up there will only handle ValueErrors. Anything else that comes up will error the test. (Not a failure, mind you, but it

[TurboGears] Re: how to test for exceptions with nose?

2006-08-04 Thread Stephen Thorne
On Fri, 2006-08-04 at 01:46 -0400, Jorge Vargas wrote: Hi I have been reading about nose and I find it great. I have been looking into TG's test and all exceptions related are like this, so say the exception name in the string but what if I must be sure that I get exception type X

[TurboGears] Re: how to test for exceptions with nose?

2006-08-04 Thread Kevin Dangoor
On Aug 4, 2006, at 1:46 AM, Jorge Vargas wrote:Hi I have been reading about nose and I find it great.I have been looking into TG's test and all exceptions related are like this, so say the exception name in the string but what if I must be sure that I get exception type X try:w.name =

[TurboGears] Re: how to test for exceptions with nose?

2006-08-04 Thread Alberto Valverde
On Aug 4, 2006, at 7:46 AM, Jorge Vargas wrote:Hi I have been reading about nose and I find it great.I have been looking into TG's test and all exceptions related are like this, so say the exception name in the string but what if I must be sure that I get exception type X try:w.name =

[TurboGears] Re: how to test for exceptions with nose?

2006-08-04 Thread Jorge Vargas
On 8/4/06, Kevin Dangoor [EMAIL PROTECTED] wrote: On Aug 4, 2006, at 1:46 AM, Jorge Vargas wrote:Hi I have been reading about nose and I find it great.I have been looking into TG's test and all exceptions related are like this, so say the exception name in the string but what if I must be sure

[TurboGears] Re: how to test for exceptions with nose?

2006-08-04 Thread Jorge Vargas
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 thatint(a) raises a

[TurboGears] Re: how to test for exceptions with nose?

2006-08-04 Thread Kevin Dangoor
On Aug 4, 2006, at 9:10 PM, Jorge Vargas wrote:On 8/4/06, Kevin Dangoor [EMAIL PROTECTED] wrote: On Aug 4, 2006, at 1:46 AM, Jorge Vargas wrote:Hi I have been reading about nose and I find it great.I have been looking into TG's test and all exceptions related are like this, so say the exception

[TurboGears] Re: how to test for exceptions with nose?

2006-08-04 Thread Jorge Vargas
On 8/4/06, Kevin Dangoor [EMAIL PROTECTED] wrote: I'm not sure what you mean. That except clause up there will only handle ValueErrors. Anything else that comes up will error the test. (Not a failure, mind you, but it still wouldn't pass..) because even if it goes in the last assert will make it