Skip to content

Instantly share code, notes, and snippets.

@berinhard
Created May 6, 2011 13:00
Show Gist options
  • Save berinhard/958910 to your computer and use it in GitHub Desktop.
Save berinhard/958910 to your computer and use it in GitHub Desktop.
Testing Django Signals
from django.test import TestCase
from your_app.signals import your_signal
class YourTestClass(TestClass):
@classmethod
def setUpClass(cls):
# Save original receivers
cls.signal_receivers = your_signal.receivers
# Erase them
your_signal.receivers = []
@classmethod
def tearDownClass(cls):
# Recover original receivers
your_signal.receivers = cls.signal_receivers
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment