diff --git a/cinder/hacking/checks.py b/cinder/hacking/checks.py index 5ce994e11a5..f794f83976b 100644 --- a/cinder/hacking/checks.py +++ b/cinder/hacking/checks.py @@ -443,15 +443,6 @@ def check_no_log_audit(logical_line): yield(0, "C304: Found LOG.audit. Use LOG.info instead.") -def check_no_contextlib_nested(logical_line): - msg = ("C305: contextlib.nested is deprecated. With Python 2.7 and later " - "the with-statement supports multiple nested objects. See https://" - "docs.python.org/2/library/contextlib.html#contextlib.nested " - "for more information.") - if no_contextlib_nested.match(logical_line): - yield(0, msg) - - def check_timeutils_strtime(logical_line): msg = ("C306: Found timeutils.strtime(). " "Please use datetime.datetime.isoformat() or datetime.strftime()") @@ -517,7 +508,6 @@ def factory(register): register(check_unicode_usage) register(check_no_print_statements) register(check_no_log_audit) - register(check_no_contextlib_nested) register(no_log_warn) register(dict_constructor_with_list_copy) register(no_test_log) diff --git a/cinder/tests/unit/test_hacking.py b/cinder/tests/unit/test_hacking.py index 9648cc28475..a118ea5b62d 100644 --- a/cinder/tests/unit/test_hacking.py +++ b/cinder/tests/unit/test_hacking.py @@ -320,16 +320,6 @@ class HackingTestCase(test.TestCase): self.assertEqual(0, len(list(checks.check_oslo_namespace_imports( "from oslo_log import bar")))) - def test_no_contextlib_nested(self): - self.assertEqual(1, len(list(checks.check_no_contextlib_nested( - "with contextlib.nested(")))) - self.assertEqual(1, len(list(checks.check_no_contextlib_nested( - " with nested(")))) - self.assertEqual(0, len(list(checks.check_no_contextlib_nested( - "with my.nested(")))) - self.assertEqual(0, len(list(checks.check_no_contextlib_nested( - "with foo as bar")))) - def test_check_datetime_now(self): self.assertEqual(1, len(list(checks.check_datetime_now( "datetime.now", False))))