#35118: Mention test-suggestions when specific email-backend is used
-------------------------------------+-------------------------------------
Reporter: jecarr | Owner: nobody
Type: | Status: closed
Cleanup/optimization |
Component: Core (Mail) | Version: 5.0
Severity: Normal | Resolution: invalid
Keywords: | Triage Stage:
| Unreviewed
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Natalia Bidart):
* status: new => closed
* resolution: => invalid
* stage: Accepted => Unreviewed
Comment:
Hello jecarr, thank you for your report.
Could you please provide more details and/or a reproducer? I've been using
Django for a long time with various email backends and tests would always
use the dummy `mail.outbox` as described in the docs, with no need of
special overriding nor monkeypatching. Also, I have just tried locally
with a test project with the email backend configured to
`django.core.mail.backends.console.EmailBackend` and when running the
example test case from the docs, I do not get emails sent to the console
backend.
Furthermore, you can see how
[https://github.com/django/django/blob/main/django/test/utils.py#L121
setup_test_environment] overrides the settings for the whole test run to
use ` django.core.mail.backends.locmem.EmailBackend`. Of course that the
docs and this response assumes that you are using the Django's TestCase.
On the other hand, if your code dynamically builds connections to various
mail backends at runtime, the tests in your code should also account for
that. This is because there is no way to cover that level of dynamicity in
Django core for all possible combinations. But from the PR linked to this
ticket, it seems that the issue is only about the configured email backend
via settings? Baptiste, were you able to reproduce? Could you share a
sample test project?
I'll be closing as invalid for now, but if I'm missing something, please
provide as much details as possible so we can re-triage. Thank you!
--
Ticket URL: <https://code.djangoproject.com/ticket/35118#comment:2>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/0107018d127efe42-0e261e65-5ccd-4d85-a935-390194734b9a-000000%40eu-central-1.amazonses.com.