I'm using Django 1.9
and django.test
for my unit test.
This is my code for testing signals
:
@receiver(post_save, sender=EmailNotification, dispatch_uid="spacegraphy")
def post_save_notification(sender, instance, created, **kwargs):
if created:
if settings.DEBUG:
print("post_save: created!!!")
else:
instance.send_notification()
When I run this application in local, it run as development mode, which shows print(settings.DEBUG)
as True
. (I checked it in shell_plus
of django-extension
However, when I test my unit tests, print(settings.DEBUG)
show False
.
I have no idea why it happened. Any idea, please?