Browse Source

Merge "Drop unicode() hacking check"

tags/16.0.0.0rc1
Zuul 3 months ago
committed by Gerrit Code Review
parent
commit
a9221afda4
3 changed files with 5 additions and 29 deletions
  1. +0
    -14
      cinder/tests/hacking/checks.py
  2. +0
    -6
      cinder/tests/unit/test_hacking.py
  3. +5
    -9
      tox.ini

+ 0
- 14
cinder/tests/hacking/checks.py View File

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


+ 0
- 6
cinder/tests/unit/test_hacking.py View File

@@ -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",


+ 5
- 9
tox.ini View File

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


Loading…
Cancel
Save