]> review.fuel-infra Code Review - openstack-build/heat-build.git/commitdiff
Remove Nova dependencies from hacking test
authorZane Bitter <zbitter@redhat.com>
Wed, 13 Mar 2013 11:41:06 +0000 (12:41 +0100)
committerZane Bitter <zbitter@redhat.com>
Wed, 13 Mar 2013 11:41:34 +0000 (12:41 +0100)
References to Nova in the docstrings(!) of the hacking.py tests caused the
run_pep8.sh 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

HACKING.rst
tools/hacking.py

index 41dc8cbba6bc6edff697b1aca118d51bacd281df..1ecaae91c288c86c262b86e69fcfec88e2e023d0 100644 (file)
@@ -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
 
index c64f86c7b4a0c95b6e2cba833721babc4bdfea6d..8b7d919a349dcdd9f84b146892e408b9e5f2b86d 100755 (executable)
@@ -165,8 +165,8 @@ def nova_import_rules(logical_line):
     Do not import more than one module per line
 
     Examples:
-    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.
-
-    N307
-    """
-    if "nova/virt" in filename and not filename.endswith("fake.py"):
-        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 foo.bar.yourclass import YourClass
     Okay: import myclass
     Okay: import foo.bar.yourclass