From 0913d70841e59ddaa5eb78a7d50cd58a5e9bb025 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 df2d180aecaf85de88f8501f2f703ffc9dc4564b) --HG-- branch : 6.0 --- tests/scenario_stock_shipment_cost.rst | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tests/scenario_stock_shipment_cost.rst b/tests/scenario_stock_shipment_cost.rst index ea9053aad6..3b8130f0a6 100644 --- a/tests/scenario_stock_shipment_cost.rst +++ b/tests/scenario_stock_shipment_cost.rst @@ -15,9 +15,11 @@ Imports:: Patch _get_shipment_cost:: - >>> from unittest.mock import Mock + >>> from unittest.mock import patch >>> from trytond.modules.stock_shipment_cost.stock import ShipmentCostMixin - >>> ShipmentCostMixin._get_shipment_cost = Mock(return_value=Decimal('5')) + >>> mock = patch.object( + ... ShipmentCostMixin, '_get_shipment_cost', + ... return_value=Decimal('5')).start() Activate modules::