Re: assertRaises doesnt catch custom error

2009-02-15 Thread pault
Thanks Karen, it now works as expected ! . In the tutorial http://docs.djangoproject.com/en/dev/intro/tutorial01/#intro-tutorial01 they use the proj in imports but I think the your first option is better as it is more pluggable in other projects that way. I wonder if there are any pros to do it

Re: assertRaises doesnt catch custom error

2009-02-15 Thread Karen Tracey
On Sun, Feb 15, 2009 at 9:46 AM, pault wrote: > > Malcom many thanks for your reply I created a new project and app to > with only one model and one test. > It still fails I know I am missing something but I cant figure out > what that is. > > I tested this on both mac OSx10.5 and vista (both pyt

Re: assertRaises doesnt catch custom error

2009-02-15 Thread pault
Malcom many thanks for your reply I created a new project and app to with only one model and one test. It still fails I know I am missing something but I cant figure out what that is. I tested this on both mac OSx10.5 and vista (both python 2.5.1 and django version 1.02) Here are my models.py an

Re: assertRaises doesnt catch custom error

2009-02-14 Thread Malcolm Tredinnick
On Sat, 2009-02-14 at 11:28 -0800, pault wrote: > I have defined a custom error but if I test if custom error gets > raised it fails if I test for Exception the test passes > > class CustomError(Exception): > """ > This exception is my custom error > """ > > class Company(models.Mode

assertRaises doesnt catch custom error

2009-02-14 Thread pault
I have defined a custom error but if I test if custom error gets raised it fails if I test for Exception the test passes class CustomError(Exception): """ This exception is my custom error """ class Company(models.Model): name = models.CharField(max_length=200) def test_erro