From 8d6836b39919855988859d8f249595a851980926 Mon Sep 17 00:00:00 2001 From: Matthew Treinish Date: Mon, 10 Dec 2012 10:07:56 -0500 Subject: [PATCH] Fix pep8 violations in stress tests This fixes pep8 failures that occur in the stress tests. These included 3 types of failures: TEMPEST N301, N306, N201 Change-Id: I54211bea03430de4ad821096eaa5264afc4f22a3 --- stress/driver.py | 15 +++++++-------- stress/pending_action.py | 2 +- stress/test_floating_ips.py | 13 +++++-------- stress/test_server_actions.py | 5 +---- stress/test_servers.py | 6 +----- stress/tests/floating_ips.py | 4 ++-- stress/utils/util.py | 2 +- 7 files changed, 18 insertions(+), 29 deletions(-) diff --git a/stress/driver.py b/stress/driver.py index 3032d58339..c50e95745b 100644 --- a/stress/driver.py +++ b/stress/driver.py @@ -15,19 +15,18 @@ Users pass in a description of the workload and a nova manager object to the bash_openstack function call""" - -import random import datetime +import random import time - -# local imports -from test_case import * -import utils.util from config import StressConfig -from state import ClusterState, KeyPairState, FloatingIpState, VolumeState +from state import ClusterState +from state import FloatingIpState +from state import KeyPairState +from state import VolumeState +from test_case import * from tempest.common.utils.data_utils import rand_name - +import utils.util # setup logging to file logging.basicConfig( diff --git a/stress/pending_action.py b/stress/pending_action.py index a2d5a6b989..635d2cc800 100644 --- a/stress/pending_action.py +++ b/stress/pending_action.py @@ -14,9 +14,9 @@ """Describe follow-up actions using `PendingAction` class to verify that nova API calls such as create/delete are completed""" - import logging import time + from tempest.exceptions import TimeoutException diff --git a/stress/test_floating_ips.py b/stress/test_floating_ips.py index 302385a36c..fcc5904d19 100755 --- a/stress/test_floating_ips.py +++ b/stress/test_floating_ips.py @@ -12,16 +12,13 @@ # See the License for the specific language governing permissions and # limitations under the License. - -# system imports -import random -import time -import telnetlib import logging +import random +import telnetlib +import time -# local imports -import test_case import pending_action +import test_case class TestChangeFloatingIp(test_case.StressTestCase): @@ -85,7 +82,7 @@ class VerifyChangeFloatingIp(pending_action.PendingAction): (self.floating_ip.address, self.elapsed())) self.floating_ip.change_pending = False return True - except: + except Exception: if not self.add: self._logger.info('%s removed [%.1f secs elapsed]' % (self.floating_ip.address, self.elapsed())) diff --git a/stress/test_server_actions.py b/stress/test_server_actions.py index 58350ac117..ca66dec619 100644 --- a/stress/test_server_actions.py +++ b/stress/test_server_actions.py @@ -17,15 +17,12 @@ API calls on the Nova cluster having to do with Server Actions. Each sub-class will have a corresponding PendingServerAction. These pending actions veriy that the API call was successful or not.""" - -# system imports import random import time -# local imports -import test_case import pending_action from tempest.exceptions import Duplicate +import test_case from utils.util import * diff --git a/stress/test_servers.py b/stress/test_servers.py index 113e5cb7b5..9957cdb98e 100644 --- a/stress/test_servers.py +++ b/stress/test_servers.py @@ -17,15 +17,11 @@ API calls on the Nova cluster having to do with creating and deleting VMs. Each sub-class will have a corresponding PendingServerAction. These pending actions veriy that the API call was successful or not.""" - -# system imports import random import time - -# local imports -import test_case import pending_action +import test_case class TestCreateVM(test_case.StressTestCase): diff --git a/stress/tests/floating_ips.py b/stress/tests/floating_ips.py index 03bd509dda..8db06d4d6f 100755 --- a/stress/tests/floating_ips.py +++ b/stress/tests/floating_ips.py @@ -13,12 +13,12 @@ # limitations under the License. """Stress test that associates/disasssociates floating ips""" -# local imports -from stress.test_floating_ips import TestChangeFloatingIp from stress.basher import BasherAction from stress.driver import * +from stress.test_floating_ips import TestChangeFloatingIp from tempest import openstack + choice_spec = [ BasherAction(TestChangeFloatingIp(), 100) ] diff --git a/stress/utils/util.py b/stress/utils/util.py index 5870ca1fa2..f90796d27c 100644 --- a/stress/utils/util.py +++ b/stress/utils/util.py @@ -14,8 +14,8 @@ # See the License for the specific language governing permissions and # limitations under the License. -import subprocess import shlex +import subprocess SSH_OPTIONS = (" -q" + " -o UserKnownHostsFile=/dev/null" +