Is there a chance that emails are sent in parallel and thus `mail.outbox.clear()` doesn't really clear outbox in my django tests?

I have written django tests to check my outbox emails as shown below

class TestX(TestCase):
    def setUp(self):
        # Clear outbox.
        mail.outbox.clear()
        super().setUp()

    def tearDown(self):
        # Clear outbox.
        mail.outbox.clear()
        super().tearDown()

however, performing assertions e.g self.assertEqual(len(mail.outbox), 1) fails with the len(mail.outbox) showing a large number as compared to the emails I've sent using send mail. I know there are other apps also sending emails so I'm wondering if the emails are being sent in parallel and thus my clear isn't effective or what might be the issue?

Back to Top