浏览代码

fix(test): Retry flaky test

test_update_document test randomly breaks in Postgres CI. The remedy right now is to re-run the builds until the success checks come up. This change retries the specific test 2 more times before failing the build
version-14
Gavin D'souza 4 年前
父节点
当前提交
7a30b2455e
共有 2 个文件被更改,包括 3 次插入0 次删除
  1. +2
    -0
      frappe/tests/test_api.py
  2. +1
    -0
      requirements.txt

+ 2
- 0
frappe/tests/test_api.py 查看文件

@@ -3,6 +3,7 @@ from random import choice

import requests
from semantic_version import Version
from tenacity import retry, stop_after_attempt, retry_if_exception_type, wait_fixed

import frappe
from frappe.utils import get_site_url
@@ -124,6 +125,7 @@ class TestResourceAPI(unittest.TestCase):
self.assertIsInstance(docname, str)
self.GENERATED_DOCUMENTS.append(docname)

@retry(stop=stop_after_attempt(2) | retry_if_exception_type(AssertionError), wait=wait_fixed(3))
def test_update_document(self):
# test 8: PUT method on /api/resource to update doc
generated_desc = frappe.mock("paragraph")


+ 1
- 0
requirements.txt 查看文件

@@ -68,6 +68,7 @@ simple-chalk~=0.1.0
six~=1.15.0
sqlparse~=0.4.1
stripe~=2.56.0
tenacity~=7.0.0
terminaltables~=3.1.0
unittest-xml-reporting~=3.0.4
urllib3~=1.26.4


正在加载...
取消
保存