Merge "Hacking: Remove C305 contextlib.nested check"
This commit is contained in:
commit
3e85c4ac22
@ -443,15 +443,6 @@ def check_no_log_audit(logical_line):
|
|||||||
yield(0, "C304: Found LOG.audit. Use LOG.info instead.")
|
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):
|
def check_timeutils_strtime(logical_line):
|
||||||
msg = ("C306: Found timeutils.strtime(). "
|
msg = ("C306: Found timeutils.strtime(). "
|
||||||
"Please use datetime.datetime.isoformat() or datetime.strftime()")
|
"Please use datetime.datetime.isoformat() or datetime.strftime()")
|
||||||
@ -517,7 +508,6 @@ def factory(register):
|
|||||||
register(check_unicode_usage)
|
register(check_unicode_usage)
|
||||||
register(check_no_print_statements)
|
register(check_no_print_statements)
|
||||||
register(check_no_log_audit)
|
register(check_no_log_audit)
|
||||||
register(check_no_contextlib_nested)
|
|
||||||
register(no_log_warn)
|
register(no_log_warn)
|
||||||
register(dict_constructor_with_list_copy)
|
register(dict_constructor_with_list_copy)
|
||||||
register(no_test_log)
|
register(no_test_log)
|
||||||
|
@ -320,16 +320,6 @@ class HackingTestCase(test.TestCase):
|
|||||||
self.assertEqual(0, len(list(checks.check_oslo_namespace_imports(
|
self.assertEqual(0, len(list(checks.check_oslo_namespace_imports(
|
||||||
"from oslo_log import bar"))))
|
"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):
|
def test_check_datetime_now(self):
|
||||||
self.assertEqual(1, len(list(checks.check_datetime_now(
|
self.assertEqual(1, len(list(checks.check_datetime_now(
|
||||||
"datetime.now", False))))
|
"datetime.now", False))))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user