From 3eb412e02076f5c0ee3109ff2091f5758f12fd2b Mon Sep 17 00:00:00 2001 From: "Moises Lopez - https://www.vauxoo.com/" Date: Wed, 21 Jan 2026 10:47:53 -0600 Subject: [PATCH] [REF] test: Add test for xml-deprecated-qweb-directive-15 check --- README.md | 1 + .../views/deprecated_qweb_directives15.xml | 7 +++++++ tests/test_checks.py | 11 ++++++++++- 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 7c3692a4..8429a221 100644 --- a/README.md +++ b/README.md @@ -462,6 +462,7 @@ options: - https://github.com/OCA/odoo-pre-commit-hooks/blob/v0.2.18/test_repo/odoo18_module/views/deprecated_qweb_directives15.xml#L6 Deprecated QWeb directive `t-esc`. Use `t-out` instead - https://github.com/OCA/odoo-pre-commit-hooks/blob/v0.2.18/test_repo/odoo18_module/views/deprecated_qweb_directives15.xml#L7 Deprecated QWeb directive `t-raw`. Use `t-out` instead + - https://github.com/OCA/odoo-pre-commit-hooks/blob/v0.2.18/test_repo/odoo18_module/views/deprecated_qweb_directives15.xml#L13 Deprecated QWeb directive `t-esc`. Use `t-out` instead * xml-deprecated-tree-attribute diff --git a/test_repo/odoo18_module/views/deprecated_qweb_directives15.xml b/test_repo/odoo18_module/views/deprecated_qweb_directives15.xml index 2077c9c3..8e1e8554 100644 --- a/test_repo/odoo18_module/views/deprecated_qweb_directives15.xml +++ b/test_repo/odoo18_module/views/deprecated_qweb_directives15.xml @@ -7,4 +7,11 @@ + diff --git a/tests/test_checks.py b/tests/test_checks.py index da08820c..65a413a1 100644 --- a/tests/test_checks.py +++ b/tests/test_checks.py @@ -35,7 +35,7 @@ "xml-dangerous-qweb-replace-low-priority": 9, "xml-deprecated-data-node": 8, "xml-deprecated-openerp-node": 4, - "xml-deprecated-qweb-directive-15": 2, + "xml-deprecated-qweb-directive-15": 3, "xml-deprecated-qweb-directive": 2, "xml-deprecated-tree-attribute": 3, "xml-double-quotes-py": 3, @@ -254,6 +254,11 @@ def test_autofix(self): with open(escaped_double_quotes, "rb") as f: content = f.read() assert b""" in content, "The escaped double quotes was previously fixed" + t_out = os.path.join(self.test_repo_path, "odoo18_module", "views", "deprecated_qweb_directives15.xml") + + with open(t_out, "rb") as f: + content = f.read() + assert b"t-out" not in content, "The deprecated t-out was previously fixed" self.checks_run(self.file_paths, autofix=True, no_exit=True, no_verbose=False) @@ -335,3 +340,7 @@ def test_autofix(self): with open(escaped_double_quotes, "rb") as f: content = f.read() assert b""" not in content, "The escaped double quotes was not fixed" + + with open(t_out, "rb") as f: + content = f.read() + assert b"t-out" in content, "The deprecated t-out was not fixed"