From 3a660be2ecadffbc0dc140ec2d89b86213ff3540 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 8df83d0cea818e030e694a61ca38e217ecaf60bc) --HG-- branch : 6.0 --- tests/scenario_sale_gift_card.rst | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tests/scenario_sale_gift_card.rst b/tests/scenario_sale_gift_card.rst index d8057c7c7a..7fcaa77558 100644 --- a/tests/scenario_sale_gift_card.rst +++ b/tests/scenario_sale_gift_card.rst @@ -15,9 +15,10 @@ Imports:: Patch sendmail_transactional:: - >>> from unittest.mock import MagicMock + >>> from unittest.mock import patch >>> from trytond.modules.sale_gift_card import sale - >>> sale.sendmail_transactional = smtp_calls = MagicMock() + >>> smtp_calls = patch.object( + ... sale, 'sendmail_transactional').start() Activate modules::