def test_25_checks_without_coverage(self): """All odoolint errors vs found""" pylint_res = self.run_pylint(self.paths_modules) msgs_found = pylint_res.linter.stats['by_msg'].keys() plugin_msgs = misc.get_plugin_msgs(pylint_res) test_missed_msgs = sorted(list(set(plugin_msgs) - set(msgs_found))) self.assertFalse( test_missed_msgs, "Checks without test case: {test_missed_msgs}".format( test_missed_msgs=test_missed_msgs))
def test_20_expected_errors(self): pylint_res = self.run_pylint(self.paths_modules) real_errors = pylint_res.linter.stats['by_msg'] self.assertEqual(EXPECTED_ERRORS, real_errors) # All odoolint name errors vs found test_missed_msgs = set( misc.get_plugin_msgs(pylint_res)) - set(real_errors.keys()) self.assertFalse(test_missed_msgs, "Checks without test case: {test_missed_msgs}".format( test_missed_msgs=test_missed_msgs))
def test_25_checks_without_coverage(self): """All odoolint errors vs found""" # Some messages can be excluded as they are only applied on certain # Odoo versions (not necessarily 8.0). excluded_msgs = { 'xml-deprecated-qweb-directive', } extra_params = ['--valid_odoo_versions=8.0'] pylint_res = self.run_pylint(self.paths_modules, extra_params) msgs_found = pylint_res.linter.stats['by_msg'].keys() plugin_msgs = set(misc.get_plugin_msgs(pylint_res)) - excluded_msgs test_missed_msgs = sorted(list(plugin_msgs - set(msgs_found))) self.assertFalse( test_missed_msgs, "Checks without test case: {test_missed_msgs}".format( test_missed_msgs=test_missed_msgs))
def test_20_expected_errors(self): pylint_res = self.run_pylint(self.paths_modules) # Expected vs found errors sum_fails_found = misc.get_sum_fails(pylint_res.linter.stats) self.assertEqual( sum_fails_found, EXPECTED_ERRORS, "Errors found {fnd} different to expected {exp}.".format( fnd=sum_fails_found, exp=EXPECTED_ERRORS)) # All odoolint name errors vs found msgs_found = pylint_res.linter.stats['by_msg'].keys() plugin_msgs = misc.get_plugin_msgs(pylint_res) test_missed_msgs = sorted(list(set(plugin_msgs) - set(msgs_found))) self.assertEqual( test_missed_msgs, [], "Checks without test case: {test_missed_msgs}".format( test_missed_msgs=test_missed_msgs))
def test_20_expected_errors(self): pylint_res = self.run_pylint(self.paths_modules) # Expected vs found errors real_errors = pylint_res.linter.stats['by_msg'] self.assertEqual(sorted(real_errors.items()), sorted(EXPECTED_ERRORS.items())) # All odoolint name errors vs found msgs_found = pylint_res.linter.stats['by_msg'].keys() plugin_msgs = misc.get_plugin_msgs(pylint_res) test_missed_msgs = sorted(list(set(plugin_msgs) - set(msgs_found))) self.assertEqual( test_missed_msgs, [], "Checks without test case: {test_missed_msgs}".format( test_missed_msgs=test_missed_msgs)) sum_fails_found = misc.get_sum_fails(pylint_res.linter.stats) sum_fails_expected = sum(EXPECTED_ERRORS.values()) self.assertEqual(sum_fails_found, sum_fails_expected)