diff --git a/.zuul.yaml b/.zuul.yaml index 438835df60..efa0344972 100644 --- a/.zuul.yaml +++ b/.zuul.yaml @@ -35,8 +35,6 @@ check: jobs: - magnum-tempest-plugin-tests-api - - magnum-tempest-plugin-tests-api-jammy gate: jobs: - magnum-tempest-plugin-tests-api - - magnum-tempest-plugin-tests-api-jammy diff --git a/HACKING.rst b/HACKING.rst index 0731a2ce70..eb79bc4dcc 100644 --- a/HACKING.rst +++ b/HACKING.rst @@ -18,7 +18,6 @@ Magnum Specific Commandments - [M336] Must use a dict comprehension instead of a dict constructor with a sequence of key-value pairs. - [M338] Use assertIn/NotIn(A, B) rather than assertEqual(A in B, True/False). -- [M339] Don't use xrange() - [M340] Check for explicit import of the _ function. - [M352] LOG.warn is deprecated. Enforce use of LOG.warning. - [M353] String interpolation should be delayed at logging calls. diff --git a/magnum/hacking/checks.py b/magnum/hacking/checks.py index fe710b7bc6..645d362266 100644 --- a/magnum/hacking/checks.py +++ b/magnum/hacking/checks.py @@ -44,8 +44,6 @@ r"(.)*assertTrue\(isinstance\((\w|\.|\'|\"|\[|\])+, " r"(\w|\.|\'|\"|\[|\])+\)\)") dict_constructor_with_list_copy_re = re.compile(r".*\bdict\((\[)?(\(|\[)") -assert_xrange_re = re.compile( - r"\s*xrange\s*\(") log_translation = re.compile( r"(.)*LOG\.(audit|error|critical)\(\s*('|\")") log_translation_info = re.compile( @@ -102,16 +100,6 @@ def assert_equal_in(logical_line): "contents.") -@core.flake8ext -def no_xrange(logical_line): - """Disallow 'xrange()' - - M339 - """ - if assert_xrange_re.match(logical_line): - yield (0, "M339: Do not use xrange().") - - @core.flake8ext def use_timeutils_utcnow(logical_line, filename): # tools are OK to use the standard datetime module diff --git a/magnum/tests/unit/objects/test_objects.py b/magnum/tests/unit/objects/test_objects.py index 3cebe0f550..dd29ccb5df 100644 --- a/magnum/tests/unit/objects/test_objects.py +++ b/magnum/tests/unit/objects/test_objects.py @@ -154,16 +154,10 @@ def test_load_in_base(self): class Foo(base.MagnumPersistentObject, base.MagnumObject): fields = {'foobar': fields.IntegerField()} obj = Foo(self.context) - # NOTE(danms): Can't use assertRaisesRegexp() because of py26 - raised = False - ex = None - try: + + def fail(): obj.foobar - except NotImplementedError as e: - raised = True - ex = e - self.assertTrue(raised) - self.assertIn('foobar', str(ex)) + self.assertRaisesRegex(NotImplementedError, 'foobar', fail) def test_loaded_in_primitive(self): obj = MyObj(self.context) diff --git a/magnum/tests/unit/test_hacking.py b/magnum/tests/unit/test_hacking.py index da10937776..f96bb14e91 100644 --- a/magnum/tests/unit/test_hacking.py +++ b/magnum/tests/unit/test_hacking.py @@ -150,16 +150,6 @@ def test_assert_true_isinstance(self): code = "self.assertTrue()" self._assert_has_no_errors(code, check) - def test_no_xrange(self): - errors = [(1, 0, "M339")] - check = checks.no_xrange - - code = "xrange(45)" - self._assert_has_errors(code, check, errors) - - code = "range(45)" - self._assert_has_no_errors(code, check) - def test_no_log_warn(self): errors = [(1, 0, "M352")] check = checks.no_log_warn diff --git a/tox.ini b/tox.ini index fc70e87281..2d3e78838e 100644 --- a/tox.ini +++ b/tox.ini @@ -116,7 +116,6 @@ extension = M322 = checks:no_mutable_default_args M336 = checks:dict_constructor_with_list_copy M338 = checks:assert_equal_in - M339 = checks:no_xrange M340 = checks:check_explicit_underscore_import M352 = checks:no_log_warn paths = ./magnum/hacking