Browse Source

Remove Nova dependencies from hacking test

References to Nova in the docstrings(!) of the tests caused the script to fail if the Grizzly development version of Nova was
not installed. Update all the references to use Heat packages instead.

Change-Id: I2e84e9a231451705d61fa9acddc65ee95a98e294
Zane Bitter 9 years ago
  1. 1
  2. 23


@ -54,7 +54,6 @@ Imports
- Do not import more than one module per line (*)
- Do not use wildcard ``*`` import (*)
- Do not make relative imports
- Do not make new heat.db imports in heat/virt/*
- Order your imports by the full module path
- Organize your imports according to the following template


@ -165,8 +165,8 @@ def nova_import_rules(logical_line):
Do not import more than one module per line
Okay: from nova.compute import api
N301: from nova.compute import api, utils
Okay: from heat.rpc import api
N301: from heat.rpc import api, client
Imports should usually be on separate lines.
@ -179,7 +179,7 @@ def nova_import_rules(logical_line):
Okay: from os import path as p
Okay: from os import (path as p)
Okay: import os.path
Okay: from nova.compute import rpcapi
Okay: from heat.engine import api
N302: from os.path import dirname as dirname2
N302: from os.path import (dirname as dirname2)
N303: from os.path import *
@ -277,7 +277,7 @@ def nova_import_alphabetical(logical_line, blank_lines, previous_logical,
nova HACKING guide recommendation for imports:
imports in human alphabetical order
Okay: import os\nimport sys\n\nimport nova\nfrom nova import test
Okay: import os\nimport sys\n\nimport heat\nfrom heat import rpc
N306: import sys\nimport os
# handle import x
@ -294,19 +294,6 @@ def nova_import_alphabetical(logical_line, blank_lines, previous_logical,
% (split_previous[1], split_line[1]))
def nova_import_no_db_in_virt(logical_line, filename):
"""Check for db calls from nova/virt
As of grizzly-2 all the database calls have been removed from
nova/virt, and we want to keep it that way.
if "nova/virt" in filename and not filename.endswith(""):
if logical_line.startswith("from nova import db"):
yield (0, "N307: nova.db import not allowed in nova/virt/*")
def in_docstring_position(previous_logical):
return (previous_logical.startswith("def ") or
previous_logical.startswith("class "))
@ -603,7 +590,7 @@ imports_on_separate_lines_N301_compliant = r"""
E401: import sys, os
N301: from subprocess import Popen, PIPE
Okay: from myclas import MyClass
Okay: from myclass import MyClass
Okay: from import YourClass
Okay: import myclass
Okay: import