Skip to content

Commit

Permalink
[REF] tests: Add jobs for each disable/enable check
Browse files Browse the repository at this point in the history
  • Loading branch information
moylop260 committed Jan 16, 2025
1 parent 8bf8028 commit c8c1872
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions tests/test_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,13 @@ def test_20_expected_errors(self):
real_errors = pylint_res.linter.stats.by_msg
self.assertEqual(self.expected_errors, real_errors)

def test_22_expected_errors_jobs(self):
"""Expected vs found errors with jobs"""
extra_params = ["--jobs=0"]
pylint_res = self.run_pylint(self.paths_modules, extra_params, verbose=True)
real_errors = pylint_res.linter.stats.by_msg
self.assertEqual(self.expected_errors, real_errors)

def test_25_checks_excluding_by_odoo_version(self):
"""All odoolint errors vs found but excluding based on Odoo version"""
excluded_msgs = {
Expand Down Expand Up @@ -382,6 +389,16 @@ def test_150_check_only_enabled_one_check(self):
expected_errors = {expected_error_name: expected_error_value}
self.assertDictEqual(real_errors, expected_errors)

def test_155_check_only_enabled_one_check_jobs(self):
"""Checking -d all -e ONLY-ONE-CHECK --jobs=0"""
disable = "--disable=all"
for expected_error_name, expected_error_value in EXPECTED_ERRORS.items():
enable = "--enable=%s" % expected_error_name
pylint_res = self.run_pylint(self.paths_modules, [disable, enable, "--jobs=0"])
real_errors = pylint_res.linter.stats.by_msg
expected_errors = {expected_error_name: expected_error_value}
self.assertDictEqual(real_errors, expected_errors)

def test_160_check_only_disabled_one_check(self):
"""Checking -d all -e odoolint -d ONLY-ONE-CHECK"""
for disable_error in EXPECTED_ERRORS:
Expand All @@ -392,6 +409,16 @@ def test_160_check_only_disabled_one_check(self):
expected_errors.pop(disable_error)
self.assertDictEqual(real_errors, expected_errors)

def test_165_check_only_disabled_one_check_jobs(self):
"""Checking -d all -e odoolint -d ONLY-ONE-CHECK --jobs=0"""
for disable_error in EXPECTED_ERRORS:
expected_errors = self.expected_errors.copy()
enable = "--disable=%s" % disable_error
pylint_res = self.run_pylint(self.paths_modules, self.default_extra_params + [enable, "--jobs=0"])
real_errors = pylint_res.linter.stats.by_msg
expected_errors.pop(disable_error)
self.assertDictEqual(real_errors, expected_errors)

def test_165_no_raises_unlink(self):
extra_params = ["--disable=all", "--enable=no-raise-unlink"]
test_repo = os.path.join(self.root_path_modules, "test_module")
Expand Down

0 comments on commit c8c1872

Please sign in to comment.