diff --git a/modules/web_shop_shopify/tests/scenario_web_shop_shopify.rst b/modules/web_shop_shopify/tests/scenario_web_shop_shopify.rst index 07c1cc3a03..c3216a3092 100644 --- a/modules/web_shop_shopify/tests/scenario_web_shop_shopify.rst +++ b/modules/web_shop_shopify/tests/scenario_web_shop_shopify.rst @@ -24,6 +24,8 @@ Imports:: >>> from trytond.modules.account_invoice.tests.tools import ( ... set_fiscalyear_invoice_sequences) + >>> FETCH_SLEEP, MAX_SLEEP = 1, 10 + Activate modules:: >>> config = activate_modules([ @@ -358,7 +360,11 @@ Check inventory item:: >>> inventory_items = ProductInventoryItem.find([]) >>> inventory_item_ids = [i.shopify_identifier ... for inv in inventory_items for i in inv.shopify_identifiers] - >>> inventory_levels = location.inventory_levels() + >>> for _ in range(MAX_SLEEP): + ... inventory_levels = location.inventory_levels() + ... if inventory_levels: + ... break + ... time.sleep(FETCH_SLEEP) >>> sorted(l.available for l in inventory_levels ... if l.available and l.inventory_item_id in inventory_item_ids) [5, 10] @@ -627,7 +633,7 @@ Clean up:: >>> for category in ShopifyIdentifier.find( ... [('record', 'like', 'product.category,%')]): ... shopify.CustomCollection.find(category.shopify_identifier).destroy() - >>> time.sleep(1) + >>> time.sleep(FETCH_SLEEP) >>> customer.destroy() >>> shopify.ShopifyResource.clear_session() diff --git a/modules/web_shop_shopify/tests/scenario_web_shop_shopify_secondary_unit.rst b/modules/web_shop_shopify/tests/scenario_web_shop_shopify_secondary_unit.rst index b7525ef11a..c59677ec12 100644 --- a/modules/web_shop_shopify/tests/scenario_web_shop_shopify_secondary_unit.rst +++ b/modules/web_shop_shopify/tests/scenario_web_shop_shopify_secondary_unit.rst @@ -24,6 +24,8 @@ Imports:: >>> from trytond.modules.account_invoice.tests.tools import ( ... set_fiscalyear_invoice_sequences) + >>> FETCH_SLEEP, MAX_SLEEP = 1, 10 + Activate modules:: >>> config = activate_modules([ @@ -190,7 +192,11 @@ Run fetch order:: ... cron_fetch_order, = Cron.find([ ... ('method', '=', 'web.shop|shopify_fetch_order'), ... ]) - ... cron_fetch_order.click('run_once') + ... for _ in range(MAX_SLEEP): + ... cron_fetch_order.click('run_once') + ... if Sale.find([]): + ... break + ... time.sleep(FETCH_SLEEP) >>> sale, = Sale.find([]) >>> len(sale.lines)