I posted this in Django users but didn't get any reply. I hope you don't mind me asking here. I does involve Django internals.
Simply put, I have an app that has a model that's consumed by other "pluggable" apps. This model will send certain signals during certain events that the pluggable apps can consume and respond to. I'd like to test that my model indeed sends the expected signal during specific actions. 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 developers (Contributions to Django itself)" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-developers+unsubscr...@googlegroups.com. To post to this group, send email to django-developers@googlegroups.com. Visit this group at http://groups.google.com/group/django-developers. To view this discussion on the web visit https://groups.google.com/d/msgid/django-developers/6d8a3d9b-b04b-4a08-93c4-8363834e41b2%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.