pytest-dev / pytest-dev/pytest-django

`mail.outbox` not being set?

Open
#589 14 comments 6 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Python
Stars
1.5k
Forks
367
PR merge metrics
No merged PRs in 30d

Description

Hey there, thanks for pytest-django! Appreciate all of the hard work, have used it quite a few times with no problems.

We're running into a bit of a snag where we upgraded some things and suddenly mail.outbox isn't retaining emails during tests. I've tried to figure out how exactly to use the mailoutbox fixture as documented here but I am having trouble using this.

Right now we're testing in a class and I have tried quite a few configurations to pass mailoutbox fixture. I.e. I updated the ini:

[pytest]
usefixtures = mailoutbox

Not exactly sure how to use that fixture though, I tried adding the positional argument mailoutbox to my class methods, still not able to access it.. I am sure I am missing something simple.

Would appreciate a push in the right direction -- and again, thanks so much for this project!

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the mailoutbox fixture documentation linked in the issue and compare its usage with the class-based test methods and pytest.ini configuration described. Reproduce the reported behavior after the dependency upgrade, then determine whether the documented fixture usage works or whether the documentation needs clarification.

Written by the indexing model from the issue text.

Assessment

Tech stack
django, python
Domain
testing-qa
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.