From 1bf0748b51d52f77e438457e69f719c5ffd46f2f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Sat, 15 May 2021 09:22:28 +0200 Subject: [PATCH] Use start and stop methods of patch in scenario This ensure that the modification on the object are removed at the end of the scenario. issue10422 review332891002 (grafted from 2b749711d629c35c1d2025fddb053ddb3bfa5edd) --HG-- branch : 6.0 --- tests/scenario_web_shop_vue_storefront.rst | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tests/scenario_web_shop_vue_storefront.rst b/tests/scenario_web_shop_vue_storefront.rst index 1dfa02fc07..c791a8c4f6 100644 --- a/tests/scenario_web_shop_vue_storefront.rst +++ b/tests/scenario_web_shop_vue_storefront.rst @@ -5,7 +5,7 @@ Web Shop Vue Storefront Scenario Imports:: >>> from decimal import Decimal - >>> from unittest.mock import MagicMock, ANY + >>> from unittest.mock import MagicMock, ANY, patch >>> from proteus import Model >>> from trytond.tests.tools import activate_modules @@ -21,7 +21,8 @@ Patch elasticsearch:: >>> from trytond.modules.web_shop_vue_storefront import web >>> es = MagicMock() - >>> web.VSFElasticsearch = MagicMock(return_value=es) + >>> _ = patch.object( + ... web, 'VSFElasticsearch', return_value=es).start() Install web_shop_vue_storefront::