Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions .zuul.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
1 change: 0 additions & 1 deletion HACKING.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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.
12 changes: 0 additions & 12 deletions magnum/hacking/checks.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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
Expand Down
12 changes: 3 additions & 9 deletions magnum/tests/unit/objects/test_objects.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
10 changes: 0 additions & 10 deletions magnum/tests/unit/test_hacking.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down