]> git.ipfire.org Git - thirdparty/paperless-ngx.git/commitdiff
Reduces the 2 mail tests flakiness
authorTrenton H <797416+stumpylog@users.noreply.github.com>
Mon, 7 Aug 2023 19:08:35 +0000 (12:08 -0700)
committerTrenton H <797416+stumpylog@users.noreply.github.com>
Mon, 7 Aug 2023 22:32:33 +0000 (15:32 -0700)
Pipfile
Pipfile.lock
src/paperless_mail/tests/test_mail.py

diff --git a/Pipfile b/Pipfile
index 4bd0ed3258aeae6c6db7abea061842bacc8057c5..623ba5e1fa647a13175d493c3b242706b11e1331 100644 (file)
--- a/Pipfile
+++ b/Pipfile
@@ -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 = "*"
index 82337c08d243b406352ce2eecaee589092f74463..30ec9c90b9c06c75ab88296f15d5c067198f27f7 100644 (file)
@@ -1,7 +1,7 @@
 {
     "_meta": {
         "hash": {
-            "sha256": "3913b5fd4b48095586e377129b3ba37f2d4610f44ae0edab736f81e103a8a837"
+            "sha256": "6ec43d0989237b0ed7da3e3306be49a1c637d2ad44222cf097b25c64c3e8d76d"
         },
         "pipfile-spec": 6,
         "requires": {},
                 "sha256:b4bf8c45bd59934ed84001ad51e11b4ee40d40a1229d2c79f9c592b0a3f6bd8a"
             ],
             "index": "pypi",
+            "markers": "python_version >= '3.7'",
             "version": "==7.4.0"
         },
         "pytest-cov": {
             "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",
index 82b874fd808b6b43c0c3ac24c0d21970e9dc39d3..d7f543def10776005015a9034040acfaa9e52bbd 100644 (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",