diff --git a/keystone/tests/unit/ksfixtures/hacking.py b/keystone/tests/unit/ksfixtures/hacking.py index 5093a19a79..caf19ce718 100644 --- a/keystone/tests/unit/ksfixtures/hacking.py +++ b/keystone/tests/unit/ksfixtures/hacking.py @@ -16,6 +16,8 @@ # test_hacking_checks test cases. # flake8: noqa +import sys + import fixtures @@ -73,11 +75,18 @@ class HackingCode(fixtures.Fixture): (25, 14, 'K001'), (25, 36, 'K001'), (28, 10, 'K001'), - (28, 27, 'K001'), + (28, 26, 'K001'), (29, 21, 'K001'), - (32, 11, 'K001'), + (32, 10, 'K001'), ]} + # NOTE(browne): This is gross, but in Python 3.4 and earlier, the ast + # module returns the incorrect col_offset for two of the defined functions + # in the code sample above. + if sys.version_info < (3, 5): + mutable_default_args['expected_errors'][12] = (28, 27, 'K001') + mutable_default_args['expected_errors'][14] = (32, 11, 'K001') + comments_begin_with_space = { 'code': """ # This is a good comment diff --git a/keystone/tests/unit/test_hacking_checks.py b/keystone/tests/unit/test_hacking_checks.py index 5c95d416a5..99592d08f0 100644 --- a/keystone/tests/unit/test_hacking_checks.py +++ b/keystone/tests/unit/test_hacking_checks.py @@ -50,7 +50,7 @@ class BaseStyleCheck(unit.BaseTestCase): def assert_has_errors(self, code, expected_errors=None): actual_errors = [e[:3] for e in self.run_check(code)] - self.assertEqual(expected_errors or [], actual_errors) + self.assertItemsEqual(expected_errors or [], actual_errors) class TestCheckForMutableDefaultArgs(BaseStyleCheck):