Merge "Hacking: Remove C305 contextlib.nested check"

This commit is contained in:
Jenkins 2016-10-04 12:13:22 +00:00 committed by Gerrit Code Review
commit 3e85c4ac22
2 changed files with 0 additions and 20 deletions

View File

@ -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)

View File

@ -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))))