{"action":"opened","issue":{"url":"https://api.github.com/repos/ojii/django-better-test/issues/2","labels_url":"https://api.github.com/repos/ojii/django-better-test/issues/2/labels{/name}","comments_url":"https://api.github.com/repos/ojii/django-better-test/issues/2/comments","events_url":"https://api.github.com/repos/ojii/django-better-test/issues/2/events","html_url":"https://github.com/ojii/django-better-test/issues/2","id":102558246,"number":2,"title":"Issue checking django.core.mail.outbox when using --parallel","user":{"login":"grantmcconnaughey","id":4023140,"avatar_url":"https://avatars.githubusercontent.com/u/4023140?v=3","gravatar_id":"","url":"https://api.github.com/users/grantmcconnaughey","html_url":"https://github.com/grantmcconnaughey","followers_url":"https://api.github.com/users/grantmcconnaughey/followers","following_url":"https://api.github.com/users/grantmcconnaughey/following{/other_user}","gists_url":"https://api.github.com/users/grantmcconnaughey/gists{/gist_id}","starred_url":"https://api.github.com/users/grantmcconnaughey/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/grantmcconnaughey/subscriptions","organizations_url":"https://api.github.com/users/grantmcconnaughey/orgs","repos_url":"https://api.github.com/users/grantmcconnaughey/repos","events_url":"https://api.github.com/users/grantmcconnaughey/events{/privacy}","received_events_url":"https://api.github.com/users/grantmcconnaughey/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-08-22T18:42:11Z","updated_at":"2015-08-22T18:42:11Z","closed_at":null,"body":"I am receiving an error in one of my tests when I use the --parallel option. My test checks `django.core.mail.outbox` to ensure that an email was sent. Here is the error:\r\n\r\n```\r\nTraceback (most recent call last):\r\n  File \"/Users/grant/Dev/django/project/project/apps/myapp/tests/test_utils.py\", line 38, in test_send_screen_share_alert\r\n    message = mail.outbox[0]\r\nIndexError: list index out of range\r\n```\r\n\r\nIn `SimpleTestCase`, the `_pre_setup()` method resets `django.core.mail.outbox` to an empty list. Here's the code:\r\n\r\n    def _pre_setup(self):\r\n        \"\"\"Performs any pre-test setup. This includes:\r\n\r\n        * Creating a test client.\r\n        * If the class has a 'urls' attribute, replace ROOT_URLCONF with it.\r\n        * Clearing the mail test outbox.\r\n        \"\"\"\r\n        self.client = self.client_class()\r\n        self._urlconf_setup()\r\n        mail.outbox = []\r\n\r\nI think the outbox gets set back to an empty list between the time that my test starts and when I check `outbox`.\r\n\r\nIf it helps, here is the test:\r\n\r\n    def test_send_screen_share_alert(self):\r\n        user = UserFactory()\r\n        phone_number = '417-555-1234'\r\n        screen_share_link = ScreenShareLinkFactory()\r\n\r\n        send_screen_share_alert(user=user, phone_number=phone_number,\r\n                                screen_share_link=screen_share_link)\r\n\r\n        message = mail.outbox[0]\r\n        self.assertEqual(len(mail.outbox), 1)\r\n        self.assertEqual(message.subject, 'Screen Share Alert')\r\n        self.assertIn(phone_number, message.body)\r\n        self.assertIn(screen_share_link.viewer_url, message.alternatives[0][0])\r\n        self.assertIn(user.get_full_name(), message.body)\r\n\r\nAt the top of my file I am importing `django.core.mail`. I am using Django 1.8.3, Python 2.7.9, Mac OS X 10.10.5."}}