Re: import twice when run test

2009-12-09 Thread Doug Blank
On Thu, Nov 26, 2009 at 6:01 AM, Tom Evans wrote: > On Thu, Nov 26, 2009 at 2:35 AM, fallhunter wrote: >> >> i have this code in my tests.py: >> >> from models import * >> >> and in the models.py I have a signal handler and register it with >> >>

Re: import twice when run test

2009-12-09 Thread Dan Fairs
Hi David, > models.signals.post_save.connect(flaggedentry_post_save, > sender=FlaggedEntry, dispatch_uid='mofin.store.models') Top tip - this worked perfectly. I see this is documented only on the wiki, I couldn't find it in the official docs. > I've found a useful place to put signal

Re: import twice when run test

2009-12-09 Thread David De La Harpe Golden
>> Python treats them as >> two different files, and hence the signal is attached twice. > -> models.signals.post_save.connect(flaggedentry_post_save, > sender=FlaggedEntry) > Or is there likely to be something else we've got wrong > in our app? > Well, just in case - watch out for the

Re: import twice when run test

2009-12-09 Thread Dan Fairs
Hi, > > > can't i put "from models import *" in the test code? what should i do? > > This happens if you import the same file using two different names. Eg, here > you are importing it as 'from models import *'. In some other part of your > code, you probably have 'from foo.models import *'.

Re: import twice when run test

2009-11-26 Thread Tom Evans
On Thu, Nov 26, 2009 at 2:35 AM, fallhunter wrote: > i have this code in my tests.py: > > from models import * > > and in the models.py I have a signal handler and register it with > > post_save.connect( post_save_note, sender=Note ) > > and when i run test with

import twice when run test

2009-11-25 Thread fallhunter
i have this code in my tests.py: from models import * and in the models.py I have a signal handler and register it with post_save.connect( post_save_note, sender=Note ) and when i run test with ./manage.py test main I found the signal handler was registered twice and executed twice, and I