From 6847ba2d6a37a1f98816c72896dd2378b059aeb5 Mon Sep 17 00:00:00 2001 From: Sean McGinnis Date: Sun, 29 Mar 2020 19:11:41 -0500 Subject: [PATCH] Drop unicode() hacking check This hacking check is no longer required now that we have moved to py3. There probably isn't much need to use unicode() calls, but if the situation calls for it, it is now better to do that than to direct people to use six methods. Some minor cleanup of hacking config included. Change-Id: I5c97e673223d29b18aad37804d0d7b8c07e501c2 Signed-off-by: Sean McGinnis --- cinder/tests/hacking/checks.py | 14 -------------- cinder/tests/unit/test_hacking.py | 6 ------ tox.ini | 14 +++++--------- 3 files changed, 5 insertions(+), 29 deletions(-) diff --git a/cinder/tests/hacking/checks.py b/cinder/tests/hacking/checks.py index 291e65fcca9..87c515fc8ea 100644 --- a/cinder/tests/hacking/checks.py +++ b/cinder/tests/hacking/checks.py @@ -309,20 +309,6 @@ def check_datetime_now(logical_line, noqa): yield(0, msg) -_UNICODE_USAGE_REGEX = re.compile(r'\bunicode *\(') - - -@core.flake8ext -def check_unicode_usage(logical_line, noqa): - if noqa: - return - - msg = "C302: Found unicode() call. Please use six.text_type()." - - if _UNICODE_USAGE_REGEX.search(logical_line): - yield(0, msg) - - @core.flake8ext def check_no_print_statements(logical_line, filename, noqa): # CLI and utils programs do need to use 'print()' so diff --git a/cinder/tests/unit/test_hacking.py b/cinder/tests/unit/test_hacking.py index 1a51bf15095..6748daacd31 100644 --- a/cinder/tests/unit/test_hacking.py +++ b/cinder/tests/unit/test_hacking.py @@ -219,12 +219,6 @@ class HackingTestCase(test.TestCase): self.assertEqual(0, len(list(checks.check_timeutils_strtime( "strftime")))) - def test_check_unicode_usage(self): - self.assertEqual(1, len(list(checks.check_unicode_usage( - "unicode(msg)", False)))) - self.assertEqual(0, len(list(checks.check_unicode_usage( - "unicode(msg) # noqa", True)))) - def test_no_print_statements(self): self.assertEqual(0, len(list(checks.check_no_print_statements( "a line with no print statement", diff --git a/tox.ini b/tox.ini index 4c2999b8900..be741db7a0d 100644 --- a/tox.ini +++ b/tox.ini @@ -199,24 +199,20 @@ max-complexity = 30 application-import-names = cinder import-order-style = pep8 -[hacking] -import_exceptions = cinder.i18n - [flake8:local-plugins] extension = - C312 = checks:no_translate_logs N322 = checks:no_mutable_default_args N323 = checks:check_explicit_underscore_import - C310 = checks:CheckLoggingFormatArgs - C311 = checks:CheckOptRegistrationArgs C301 = checks:check_datetime_now + C303 = checks:check_no_print_statements C306 = checks:check_timeutils_strtime C308 = checks:check_timeutils_isotime - C302 = checks:check_unicode_usage - C303 = checks:check_no_print_statements - C336 = checks:dict_constructor_with_list_copy C309 = checks:no_test_log + C310 = checks:CheckLoggingFormatArgs + C311 = checks:CheckOptRegistrationArgs + C312 = checks:no_translate_logs C313 = checks:validate_assertTrue + C336 = checks:dict_constructor_with_list_copy paths = ./cinder/tests/hacking [doc8]