From a362d0eb9f3b620c567e9517f7be790e7a1c7f9b Mon Sep 17 00:00:00 2001 From: Jairo Llopis Date: Mon, 8 Oct 2018 11:54:12 +0000 Subject: [PATCH] [FIX] tests: Make `at_install` and `post_install` backwards compatible Fixes #27471 by just using `tagged()` behind the scenes. calls to `tagged` were done in the wrong order closes odoo/odoo#27531 --- odoo/tests/common.py | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/odoo/tests/common.py b/odoo/tests/common.py index fd2824ced76..19b77942de0 100644 --- a/odoo/tests/common.py +++ b/odoo/tests/common.py @@ -99,10 +99,7 @@ def at_install(flag): ``at_install`` is now a flag, you can use :func:`tagged` to add/remove it, although ``tagged`` only works on test classes """ - def decorator(obj): - obj.at_install = flag - return obj - return decorator + return tagged('at_install' if flag else '-at_install') def post_install(flag): """ Sets the post-install state of a test. The flag is a boolean @@ -117,10 +114,7 @@ def post_install(flag): ``post_install`` is now a flag, you can use :func:`tagged` to add/remove it, although ``tagged`` only works on test classes """ - def decorator(obj): - obj.post_install = flag - return obj - return decorator + return tagged('post_install' if flag else '-post_install') class TreeCase(unittest.TestCase): def __init__(self, methodName='runTest'):