Skip to content

Commit 8552948

Browse files
committed
django_mail_patch_dns: check _django_settings_is_configured:
1 parent d4b3b3d commit 8552948

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

pytest_django/plugin.py

+5-3
Original file line numberDiff line numberDiff line change
@@ -576,10 +576,12 @@ def mailoutbox(django_mail_patch_dns, _dj_autoclear_mailbox,
576576

577577

578578
@pytest.fixture(scope="function")
579-
def django_mail_patch_dns(monkeypatch, django_mail_dnsname):
580-
from django.core import mail
579+
def django_mail_patch_dns(monkeypatch, django_mail_dnsname,
580+
_django_settings_is_configured):
581+
if _django_settings_is_configured:
582+
from django.core import mail
581583

582-
monkeypatch.setattr(mail.message, "DNS_NAME", django_mail_dnsname)
584+
monkeypatch.setattr(mail.message, "DNS_NAME", django_mail_dnsname)
583585

584586

585587
@pytest.fixture(scope="function")

0 commit comments

Comments
 (0)