Reduces the 2 mail tests flakiness

This commit is contained in:
Trenton H 2023-08-07 12:08:35 -07:00
parent 0b26b7098a
commit b961df90a7
3 changed files with 20 additions and 9 deletions

View File

@ -81,12 +81,14 @@ pytest-httpx = "*"
pytest-env = "*"
pytest-sugar = "*"
pytest-xdist = "*"
pytest-rerunfailures = "*"
"pdfminer.six" = "*"
imagehash = "*"
daphne = "*"
# Documentation
mkdocs-material = "*"
[typing-dev]
mypy = "*"
types-Pillow = "*"

12
Pipfile.lock generated
View File

@ -1,7 +1,7 @@
{
"_meta": {
"hash": {
"sha256": "3913b5fd4b48095586e377129b3ba37f2d4610f44ae0edab736f81e103a8a837"
"sha256": "6ec43d0989237b0ed7da3e3306be49a1c637d2ad44222cf097b25c64c3e8d76d"
},
"pipfile-spec": 6,
"requires": {},
@ -2921,6 +2921,7 @@
"sha256:b4bf8c45bd59934ed84001ad51e11b4ee40d40a1229d2c79f9c592b0a3f6bd8a"
],
"index": "pypi",
"markers": "python_version >= '3.7'",
"version": "==7.4.0"
},
"pytest-cov": {
@ -2955,6 +2956,15 @@
"index": "pypi",
"version": "==0.22.0"
},
"pytest-rerunfailures": {
"hashes": [
"sha256:784f462fa87fe9bdf781d0027d856b47a4bfe6c12af108f6bd887057a917b48e",
"sha256:9a1afd04e21b8177faf08a9bbbf44de7a0fe3fc29f8ddbe83b9684bd5f8f92a9"
],
"index": "pypi",
"markers": "python_version >= '3.7'",
"version": "==12.0"
},
"pytest-sugar": {
"hashes": [
"sha256:8cb5a4e5f8bbcd834622b0235db9e50432f4cbd71fef55b467fe44e43701e062",

View File

@ -9,6 +9,7 @@ from typing import Optional
from typing import Union
from unittest import mock
import pytest
from django.core.management import call_command
from django.db import DatabaseError
from django.test import TestCase
@ -400,8 +401,7 @@ class TestMail(
attachments=2,
)
account = MailAccount()
account.save()
account = MailAccount.objects.create()
rule = MailRule(
assign_title_from=MailRule.TitleSource.FROM_FILENAME,
account=account,
@ -445,8 +445,7 @@ class TestMail(
],
)
account = MailAccount()
account.save()
account = MailAccount.objects.create()
rule = MailRule(
assign_title_from=MailRule.TitleSource.FROM_FILENAME,
account=account,
@ -475,8 +474,7 @@ class TestMail(
],
)
account = MailAccount()
account.save()
account = MailAccount.objects.create()
rule = MailRule(
assign_title_from=MailRule.TitleSource.FROM_FILENAME,
account=account,
@ -504,8 +502,7 @@ class TestMail(
],
)
account = MailAccount()
account.save()
account = MailAccount.objects.create()
rule = MailRule(
assign_title_from=MailRule.TitleSource.FROM_FILENAME,
account=account,
@ -696,6 +693,7 @@ class TestMail(
self.assertEqual(len(self.bogus_mailbox.fetch("UNFLAGGED", False)), 1)
self.assertEqual(len(self.bogus_mailbox.messages), 3)
@pytest.mark.flaky(reruns=4)
def test_handle_mail_account_move(self):
account = MailAccount.objects.create(
name="test",
@ -854,6 +852,7 @@ class TestMail(
):
self.mail_account_handler.handle_mail_account(account)
@pytest.mark.flaky(reruns=4)
def test_error_skip_account(self):
_ = MailAccount.objects.create(
name="test",