Skip to content

Commit

Permalink
Merge bfabac3 into 1557991
Browse files Browse the repository at this point in the history
  • Loading branch information
moylop260 committed Dec 1, 2021
2 parents 1557991 + bfabac3 commit 55d4412
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
2 changes: 1 addition & 1 deletion pylint_odoo/misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ def _check_{NAME_KEY}(self, module_path)
self.manifest_dict = {}
self.manifest_file = None
self.is_main_odoo_module = False
if self.manifest_file and (
if self.manifest_file and os.path.basename(node.file) == '__init__.py' and (
node.name.count('.') == 0 or
node.name.endswith(self.odoo_module_name_with_ns)
):
Expand Down
18 changes: 18 additions & 0 deletions pylint_odoo/test/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -414,6 +414,24 @@ def test_140_check_suppress_migrations(self):
}
self.assertDictEqual(real_errors, expected_errors)

def test_140_check_migrations_is_not_odoo_module(self):
"""Related to https://github.com/OCA/pylint-odoo/issues/357"""
extra_params = [
'--disable=all',
'--enable=missing-readme',
]
test_module = os.path.join(
os.path.dirname(os.path.dirname(os.path.realpath(__file__))),
'test_repo', 'test_module')
path_modules = [
os.path.join(test_module, '__init__.py'),
os.path.join(test_module, 'migrations', '10.0.1.0.0', 'pre-migration.py')]
# Messages suppressed with plugin for migration
pylint_res = self.run_pylint(path_modules, extra_params)
real_errors = pylint_res.linter.stats['by_msg']
expected_errors = {}
self.assertDictEqual(real_errors, expected_errors)


if __name__ == '__main__':
unittest.main()

0 comments on commit 55d4412

Please sign in to comment.