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
+2 -2
View File
@@ -3,11 +3,11 @@ Created on 2010/12/20
@author: Nachi Ueno <ueno.nachi@lab.ntt.co.jp> @author: Nachi Ueno <ueno.nachi@lab.ntt.co.jp>
''' '''
import boto
import base64 import base64
import boto
import boto.ec2 import boto.ec2
from boto_v6.ec2.instance import ReservationV6
from boto.ec2.securitygroup import SecurityGroup from boto.ec2.securitygroup import SecurityGroup
from boto_v6.ec2.instance import ReservationV6
class EC2ConnectionV6(boto.ec2.EC2Connection): class EC2ConnectionV6(boto.ec2.EC2Connection):
+2 -2
View File
@@ -3,10 +3,10 @@ Created on 2010/12/20
@author: Nachi Ueno <ueno.nachi@lab.ntt.co.jp> @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 Group
from boto.ec2.instance import Instance from boto.ec2.instance import Instance
from boto.ec2.instance import Reservation
from boto.resultset import ResultSet
class ReservationV6(Reservation): class ReservationV6(Reservation):
@@ -26,6 +26,7 @@ try:
import json import json
except ImportError: except ImportError:
import simplejson as json import simplejson as json
import logging import logging
import os import os
import subprocess import subprocess
+3 -3
View File
@@ -17,6 +17,7 @@
# under the License. # under the License.
import boto import boto
from boto.ec2.regioninfo import RegionInfo
import commands import commands
import httplib import httplib
import os import os
@@ -24,7 +25,6 @@ import paramiko
import sys import sys
import time import time
import unittest import unittest
from boto.ec2.regioninfo import RegionInfo
from smoketests import flags from smoketests import flags
@@ -150,7 +150,7 @@ class SmokeTestCase(unittest.TestCase):
def create_key_pair(self, conn, key_name): def create_key_pair(self, conn, key_name):
try: try:
os.remove('/tmp/%s.pem' % key_name) os.remove('/tmp/%s.pem' % key_name)
except: except Exception:
pass pass
key = conn.create_key_pair(key_name) key = conn.create_key_pair(key_name)
key.save('/tmp/') key.save('/tmp/')
@@ -160,7 +160,7 @@ class SmokeTestCase(unittest.TestCase):
conn.delete_key_pair(key_name) conn.delete_key_pair(key_name)
try: try:
os.remove('/tmp/%s.pem' % key_name) os.remove('/tmp/%s.pem' % key_name)
except: except Exception:
pass pass
def bundle_image(self, image, tempdir='/tmp', kernel=False): def bundle_image(self, image, tempdir='/tmp', kernel=False):
+1 -1
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')): if os.path.exists(os.path.join(possible_topdir, 'nova', '__init__.py')):
sys.path.insert(0, possible_topdir) sys.path.insert(0, possible_topdir)
from smoketests import flags
from smoketests import base from smoketests import base
from smoketests import flags
#Note that this test should run from #Note that this test should run from
#public network (outside of private network segments) #public network (outside of private network segments)
+9 -5
View File
@@ -57,8 +57,8 @@ To run a single test module:
import gettext import gettext
import os import os
import unittest
import sys import sys
import unittest
# If ../nova/__init__.py exists, add ../ to Python search path, so that # 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... # it will override what happens to be installed in /usr/(local/)lib/python...
@@ -110,7 +110,7 @@ class _AnsiColorizer(object):
except curses.error: except curses.error:
curses.setupterm() curses.setupterm()
return curses.tigetnum("colors") > 2 return curses.tigetnum("colors") > 2
except: except Exception:
raise raise
# guess false in case of error # guess false in case of error
return False return False
@@ -133,9 +133,13 @@ class _Win32Colorizer(object):
See _AnsiColorizer docstring. See _AnsiColorizer docstring.
""" """
def __init__(self, stream): def __init__(self, stream):
from win32console import (GetStdHandle, STD_OUT_HANDLE, from win32console import FOREGROUND_BLUE
FOREGROUND_RED, FOREGROUND_GREEN, from win32console import FOREGROUND_GREEN
FOREGROUND_BLUE, FOREGROUND_INTENSITY) 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, red, green, blue, bold = (FOREGROUND_RED, FOREGROUND_GREEN,
FOREGROUND_BLUE, FOREGROUND_INTENSITY) FOREGROUND_BLUE, FOREGROUND_INTENSITY)
self.stream = stream self.stream = stream
+1 -1
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')): if os.path.exists(os.path.join(possible_topdir, 'nova', '__init__.py')):
sys.path.insert(0, possible_topdir) sys.path.insert(0, possible_topdir)
from smoketests import flags
from smoketests import base from smoketests import base
from smoketests import flags
FLAGS = flags.FLAGS FLAGS = flags.FLAGS
+4 -4
View File
@@ -18,10 +18,10 @@
import os import os
import random import random
import sys
import time
import tempfile
import shutil import shutil
import sys
import tempfile
import time
# If ../nova/__init__.py exists, add ../ to Python search path, so that # 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... # 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')): if os.path.exists(os.path.join(possible_topdir, 'nova', '__init__.py')):
sys.path.insert(0, possible_topdir) sys.path.insert(0, possible_topdir)
from smoketests import flags
from smoketests import base from smoketests import base
from smoketests import flags
FLAGS = flags.FLAGS FLAGS = flags.FLAGS
flags.DEFINE_string('bundle_kernel', 'random.kernel', flags.DEFINE_string('bundle_kernel', 'random.kernel',
+1 -1
View File
@@ -18,7 +18,7 @@ downloadcache = ~/cache/pip
[testenv:pep8] [testenv:pep8]
deps = pep8==1.1 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] [testenv:cover]
setenv = NOSE_WITH_COVERAGE=1 setenv = NOSE_WITH_COVERAGE=1