details:   https://code.tryton.org/tryton/commit/05798a542194
branch:    7.8
user:      Cédric Krier <[email protected]>
date:      Wed Dec 31 11:32:52 2025 +0100
description:
        Retries when testing fetching message from Peppyrus

        The process of the message may be delayed by Peppyrus so we must retry 
until
        the message is fetched.
        (grafted from 116b9edb56a7875fff9ec789b65002755b2a7e32)
diffstat:

 modules/edocument_peppol_peppyrus/tests/scenario_edocument_peppol_peppyrus.rst 
|  16 ++++++---
 1 files changed, 11 insertions(+), 5 deletions(-)

diffs (39 lines):

diff -r 284555717bcc -r 05798a542194 
modules/edocument_peppol_peppyrus/tests/scenario_edocument_peppol_peppyrus.rst
--- 
a/modules/edocument_peppol_peppyrus/tests/scenario_edocument_peppol_peppyrus.rst
    Fri Jan 02 10:59:39 2026 +0100
+++ 
b/modules/edocument_peppol_peppyrus/tests/scenario_edocument_peppol_peppyrus.rst
    Wed Dec 31 11:32:52 2025 +0100
@@ -5,6 +5,7 @@
 Imports::
 
     >>> import os
+    >>> import time
     >>> from unittest.mock import patch
 
     >>> from proteus import Model
@@ -13,6 +14,8 @@
     >>> from trytond.tests.tools import activate_modules
     >>> from trytond.tools import file_open
 
+    >>> FETCH_SLEEP, MAX_SLEEP = 1, 20
+
 Patch Peppol::
 
     >>> _validate = patch.object(Peppol, '_validate').start()
@@ -69,10 +72,13 @@
 
 Fetch messages::
 
-    >>> cron, = Cron.find([
-    ...         ('method', '=', 'edocument.peppol.service|peppyrus_fetch'),
-    ...         ], limit=1)
-    >>> cron.click('run_once')
-
+    >>> for _ in range(MAX_SLEEP):
+    ...     cron, = Cron.find([
+    ...             ('method', '=', 'edocument.peppol.service|peppyrus_fetch'),
+    ...             ], limit=1)
+    ...     cron.click('run_once')
+    ...     if bool(Peppol.find([('direction', '=', 'in')])):
+    ...         break
+    ...     time.sleep(FETCH_SLEEP)
     >>> bool(Peppol.find([('direction', '=', 'in')]))
     True

Reply via email to