Boa. Funciona para resolver esse problema.

Atenciosamente,
Vinicius Mendes
Engenheiro de Computação
Globo.com



On Thu, May 5, 2011 at 1:33 PM, Bernardo Fontes <bernardo...@gmail.com>wrote:

> Hello everybody,
>
> I resolved this problem by looking at Djangos Signal's code and
> understanding its structure. The signal has an attribute called receivers
> which has stored references to its receivers function that were connect to
> it. When the send function is called, the signal just call this function
> which are in this receivers list. So, I created a setUpClass and a
> tearDownClass that does a monkey patch with my signal. It's like this:
>
>
> class YourTestClass(TestCase):
>
>
>     @classmethod
>     def setUpClass(cls):
>         cls.signal_receivers = my_signal.receivers
>         my_signal.receivers = []
>
>
>     @classmethod
>     def tearDownClass(cls):
>         my_signal.receivers = cls.signal_receivers
>
> Hope I could help!
>
>
> --
> Bernardo Fontes
> http://www.bernardofontes.net
> bernardo...@gmail.com <falecom...@bernardofontes.net>
> Skype: bernardoxhc
> (21) 9629 1621
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to