Run hacking tests as part of the gate.

Nova has additional pep8 "plugins" that they expect to run as part of the
gate. This patch will run tools/hacking.py instead of pep8 directly. Also,
it fixes the hacking violaions in contrib, plugins and smoketests.

Fixes bug 1010136

Change-Id: I86d8789218c197d5d4a43d1201465d340646a395
This commit is contained in:
Monty Taylor 2012-07-02 08:48:28 -04:00
parent 019d953ef5
commit 8d8d3b4296
9 changed files with 24 additions and 19 deletions

View File

@ -3,11 +3,11 @@ Created on 2010/12/20
@author: Nachi Ueno <ueno.nachi@lab.ntt.co.jp>
'''
import boto
import base64
import boto
import boto.ec2
from boto_v6.ec2.instance import ReservationV6
from boto.ec2.securitygroup import SecurityGroup
from boto_v6.ec2.instance import ReservationV6
class EC2ConnectionV6(boto.ec2.EC2Connection):

View File

@ -3,10 +3,10 @@ Created on 2010/12/20
@author: Nachi Ueno <ueno.nachi@lab.ntt.co.jp>
'''
from boto.resultset import ResultSet
from boto.ec2.instance import Reservation
from boto.ec2.instance import Group
from boto.ec2.instance import Instance
from boto.ec2.instance import Reservation
from boto.resultset import ResultSet
class ReservationV6(Reservation):

View File

@ -26,6 +26,7 @@ try:
import json
except ImportError:
import simplejson as json
import logging
import os
import subprocess

View File

@ -17,6 +17,7 @@
# under the License.
import boto
from boto.ec2.regioninfo import RegionInfo
import commands
import httplib
import os
@ -24,7 +25,6 @@ import paramiko
import sys
import time
import unittest
from boto.ec2.regioninfo import RegionInfo
from smoketests import flags
@ -150,7 +150,7 @@ class SmokeTestCase(unittest.TestCase):
def create_key_pair(self, conn, key_name):
try:
os.remove('/tmp/%s.pem' % key_name)
except:
except Exception:
pass
key = conn.create_key_pair(key_name)
key.save('/tmp/')
@ -160,7 +160,7 @@ class SmokeTestCase(unittest.TestCase):
conn.delete_key_pair(key_name)
try:
os.remove('/tmp/%s.pem' % key_name)
except:
except Exception:
pass
def bundle_image(self, image, tempdir='/tmp', kernel=False):

View File

@ -30,8 +30,8 @@ possible_topdir = os.path.normpath(os.path.join(os.path.abspath(sys.argv[0]),
if os.path.exists(os.path.join(possible_topdir, 'nova', '__init__.py')):
sys.path.insert(0, possible_topdir)
from smoketests import flags
from smoketests import base
from smoketests import flags
#Note that this test should run from
#public network (outside of private network segments)

View File

@ -57,8 +57,8 @@ To run a single test module:
import gettext
import os
import unittest
import sys
import unittest
# If ../nova/__init__.py exists, add ../ to Python search path, so that
# it will override what happens to be installed in /usr/(local/)lib/python...
@ -110,7 +110,7 @@ class _AnsiColorizer(object):
except curses.error:
curses.setupterm()
return curses.tigetnum("colors") > 2
except:
except Exception:
raise
# guess false in case of error
return False
@ -133,9 +133,13 @@ class _Win32Colorizer(object):
See _AnsiColorizer docstring.
"""
def __init__(self, stream):
from win32console import (GetStdHandle, STD_OUT_HANDLE,
FOREGROUND_RED, FOREGROUND_GREEN,
FOREGROUND_BLUE, FOREGROUND_INTENSITY)
from win32console import FOREGROUND_BLUE
from win32console import FOREGROUND_GREEN
from win32console import FOREGROUND_INTENSITY
from win32console import FOREGROUND_RED
from win32console import GetStdHandle
from win32console import STD_OUT_HANDLE
red, green, blue, bold = (FOREGROUND_RED, FOREGROUND_GREEN,
FOREGROUND_BLUE, FOREGROUND_INTENSITY)
self.stream = stream

View File

@ -30,8 +30,8 @@ possible_topdir = os.path.normpath(os.path.join(os.path.abspath(sys.argv[0]),
if os.path.exists(os.path.join(possible_topdir, 'nova', '__init__.py')):
sys.path.insert(0, possible_topdir)
from smoketests import flags
from smoketests import base
from smoketests import flags
FLAGS = flags.FLAGS

View File

@ -18,10 +18,10 @@
import os
import random
import sys
import time
import tempfile
import shutil
import sys
import tempfile
import time
# If ../nova/__init__.py exists, add ../ to Python search path, so that
# it will override what happens to be installed in /usr/(local/)lib/python...
@ -31,8 +31,8 @@ possible_topdir = os.path.normpath(os.path.join(os.path.abspath(sys.argv[0]),
if os.path.exists(os.path.join(possible_topdir, 'nova', '__init__.py')):
sys.path.insert(0, possible_topdir)
from smoketests import flags
from smoketests import base
from smoketests import flags
FLAGS = flags.FLAGS
flags.DEFINE_string('bundle_kernel', 'random.kernel',

View File

@ -18,7 +18,7 @@ downloadcache = ~/cache/pip
[testenv:pep8]
deps = pep8==1.1
commands = pep8 --repeat --show-source --exclude=.venv,.tox,dist,doc,*egg .
commands = python tools/hacking.py --ignore=N4 --repeat --show-source --exclude=.venv,.tox,dist,doc,*egg .
[testenv:cover]
setenv = NOSE_WITH_COVERAGE=1