Turning off signals dispatch when testing units

Model signals pre_save and post_save will be turned off when running
unit tests because they are interfering with the tests.
remotes/origin/enhancement/email-actions
Anler Hp 2014-05-20 16:12:17 +02:00 committed by David Barragán Merino
parent 9bca29ce20
commit 55f5c70e4e
1 changed files with 10 additions and 0 deletions

10
tests/unit/conftest.py Normal file
View File

@ -0,0 +1,10 @@
from django.db.models import signals
def disconnect_signals():
signals.pre_save.receivers = []
signals.post_save.receivers = []
def pytest_runtest_setup(item):
disconnect_signals()