I have an app that fires a custom signal when a specific method is called. 
I wrote a test that connects to the signal in setUp() and uses a local 
listener function to set a class attribute to True if the handler is 
called. You can see the relevant code here:

https://dpaste.de/mAGw

This works fine if I test the module directly using ./manage.py test <app> 
test_models.py. However if I run test <app> or simply test the signals 
don't appear to connect. Using PyCharm I stepped through the code and found 
that when I call .connect() in my TestCase, and step into Signal.connect() 
I can see all of the expected receivers on `self.receivers`. 

However if I step into the Signal.send() method when the signal is fired, 
none of the expected receivers are in place. Again, this works if I test 
the module directly just not if I use `test <app>` or `test`. 

Does anyone have any guidance on how I could get this to work? Thanks!

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/8390428d-f5a4-4e51-860f-6e7c1d965e6b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to