[FIX] test_lint: l10n linter
The linter would require flagging "Common" classes with `post_install_l10n`, which is incorrect but innocuous before tag inheritance, however it's incorrect and broken with tag inheritance. Fix to only apply the lint to actual test containers. Although eventually the analysis should probably run on the actual classes, so that the "common" classes can be tagged and the children don't need to be (since they inherit tagging from their parents). Part-of: odoo/odoo#98814
This commit is contained in:
@@ -28,10 +28,14 @@ class L10nChecker(lint_case.NodeVisitor):
|
||||
(len({'post_install_l10n', 'external_l10n'} & tags) != 1)
|
||||
or ('post_install_l10n' in tags and 'post_install' not in tags)
|
||||
# or ('post_install_l10n' not in tags and 'post_install' in tags)
|
||||
or ('external_l10n' in tags and 'external' not in tags)
|
||||
or ('external_l10n' not in tags and 'external' in tags)
|
||||
or (('external_l10n' in tags) ^ ('external' in tags))
|
||||
):
|
||||
return [node]
|
||||
if any(
|
||||
stmt.name.startswith('test_')
|
||||
for stmt in node.body
|
||||
if isinstance(stmt, ast.FunctionDef)
|
||||
):
|
||||
return [node]
|
||||
return []
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user