Hacking: Remove N333 oslo namespace import check

This is no longer needed, as current oslo libraries
don't export this namespace any longer, so other
tests will fail and catch this problem.

Related: I49c74ade374582f53a3678a1bc7df194c24e892e
Change-Id: I2af1679f1e2e82ba18d01e092ff8d01fa1537ca1
This commit is contained in:
Eric Harney 2016-12-12 10:06:39 -05:00
parent 0f1a2202c9
commit eca603bdd9
3 changed files with 0 additions and 36 deletions

View File

@ -15,7 +15,6 @@ Cinder Specific Commandments
- [N328] LOG.info messages require translations `_LI()`.
- [N329] LOG.exception and LOG.error messages require translations `_LE()`.
- [N330] LOG.warning messages require translations `_LW()`.
- [N333] Ensure that oslo namespaces are used for namespaced libraries.
- [N336] Must use a dict comprehension instead of a dict constructor with a sequence of key-value pairs.
- [C301] timeutils.utcnow() from oslo_utils should be used instead of datetime.now().
- [C302] six.text_type should be used instead of unicode.

View File

@ -383,14 +383,6 @@ def validate_log_translations(logical_line, filename):
yield (0, msg)
def check_oslo_namespace_imports(logical_line):
if re.match(oslo_namespace_imports, logical_line):
msg = ("N333: '%s' must be used instead of '%s'.") % (
logical_line.replace('oslo.', 'oslo_'),
logical_line)
yield(0, msg)
def check_datetime_now(logical_line, noqa):
if noqa:
return
@ -500,7 +492,6 @@ def factory(register):
register(CheckForStrUnicodeExc)
register(CheckLoggingFormatArgs)
register(CheckOptRegistrationArgs)
register(check_oslo_namespace_imports)
register(check_datetime_now)
register(check_timeutils_strtime)
register(check_timeutils_isotime)

View File

@ -294,32 +294,6 @@ class HackingTestCase(test.TestCase):
self.assertEqual(1, len(list(checks.no_mutable_default_args(
"def foo (bar={}):"))))
def test_oslo_namespace_imports_check(self):
self.assertEqual(1, len(list(checks.check_oslo_namespace_imports(
"from oslo.concurrency import foo"))))
self.assertEqual(0, len(list(checks.check_oslo_namespace_imports(
"from oslo_concurrency import bar"))))
self.assertEqual(1, len(list(checks.check_oslo_namespace_imports(
"from oslo.db import foo"))))
self.assertEqual(0, len(list(checks.check_oslo_namespace_imports(
"from oslo_db import bar"))))
self.assertEqual(1, len(list(checks.check_oslo_namespace_imports(
"from oslo.config import foo"))))
self.assertEqual(0, len(list(checks.check_oslo_namespace_imports(
"from oslo_config import bar"))))
self.assertEqual(1, len(list(checks.check_oslo_namespace_imports(
"from oslo.utils import foo"))))
self.assertEqual(0, len(list(checks.check_oslo_namespace_imports(
"from oslo_utils import bar"))))
self.assertEqual(1, len(list(checks.check_oslo_namespace_imports(
"from oslo.serialization import foo"))))
self.assertEqual(0, len(list(checks.check_oslo_namespace_imports(
"from oslo_serialization import bar"))))
self.assertEqual(1, len(list(checks.check_oslo_namespace_imports(
"from oslo.log import foo"))))
self.assertEqual(0, len(list(checks.check_oslo_namespace_imports(
"from oslo_log import bar"))))
def test_check_datetime_now(self):
self.assertEqual(1, len(list(checks.check_datetime_now(
"datetime.now", False))))