From e299f86d06540e0e688d48861fb54857b948cb41 Mon Sep 17 00:00:00 2001 From: Terry Wilson Date: Fri, 24 Feb 2017 15:32:17 -0500 Subject: [PATCH] Fix pep8/cookiecutter test running --- .testr.conf | 8 ++++++++ ovsdbapp/exceptions.py | 2 +- ovsdbapp/impl_idl.py | 2 +- ovsdbapp/native/commands.py | 15 +++++++-------- ovsdbapp/native/connection.py | 7 ++++--- ovsdbapp/native/helpers.py | 1 + ovsdbapp/native/idlutils.py | 2 +- test-requirements.txt | 1 + tox.ini | 2 +- 9 files changed, 25 insertions(+), 15 deletions(-) create mode 100644 .testr.conf diff --git a/.testr.conf b/.testr.conf new file mode 100644 index 00000000..878cf078 --- /dev/null +++ b/.testr.conf @@ -0,0 +1,8 @@ +[DEFAULT] +test_command=OS_STDOUT_CAPTURE=${OS_STDOUT_CAPTURE:-1} \ + OS_STDERR_CAPTURE=${OS_STDERR_CAPTURE:-1} \ + OS_LOG_CAPTURE=${OS_LOG_CAPTURE:-1} \ + OS_TEST_TIMEOUT=${OS_TEST_TIMEOUT:-160} \ + ${PYTHON:-python} -m subunit.run discover -t ./ ${OS_TEST_PATH:-./ovsdbapp/tests} $LISTOPT $IDOPTION +test_id_option=--load-list $IDFILE +test_list_option=--list diff --git a/ovsdbapp/exceptions.py b/ovsdbapp/exceptions.py index 9a520c56..d2614088 100644 --- a/ovsdbapp/exceptions.py +++ b/ovsdbapp/exceptions.py @@ -37,7 +37,7 @@ class OvsdbAppException(Exception): if six.PY2: def __unicode__(self): - return unicode(self.msg) + return unicode(self.msg) # noqa def __str__(self): return self.msg diff --git a/ovsdbapp/impl_idl.py b/ovsdbapp/impl_idl.py index 83659d68..0f1609e1 100644 --- a/ovsdbapp/impl_idl.py +++ b/ovsdbapp/impl_idl.py @@ -15,11 +15,11 @@ import logging import time -from ovsdbapp import exceptions from ovs.db import idl from six.moves import queue as Queue from ovsdbapp import api +from ovsdbapp import exceptions from ovsdbapp.native import commands as cmd from ovsdbapp.native import connection from ovsdbapp.native import idlutils diff --git a/ovsdbapp/native/commands.py b/ovsdbapp/native/commands.py index e693bf39..8bec6d01 100644 --- a/ovsdbapp/native/commands.py +++ b/ovsdbapp/native/commands.py @@ -503,7 +503,7 @@ class InterfaceToBridgeCommand(BaseCommand): self.name) ports = self.api._tables['Port'].rows.values() pname = next( - port for port in ports if interface in port.interfaces) + port for port in ports if interface in port.interfaces) bridges = self.api._tables['Bridge'].rows.values() self.result = next(br.name for br in bridges if pname in br.ports) @@ -533,13 +533,12 @@ class DbListCommand(BaseCommand): # for compat with the vsctl version. It might make more # sense to change this to a RowNotFoundError in the future. raise RuntimeError( - "Row doesn't exist in the DB. Request info: " - "Table=%(table)s. Columns=%(columns)s. " - "Records=%(records)s." % { - "table": self.table, - "columns": self.columns, - "records": self.records, - }) + "Row doesn't exist in the DB. Request info: " + "Table=%(table)s. Columns=%(columns)s. " + "Records=%(records)s." % { + "table": self.table, + "columns": self.columns, + "records": self.records}) else: row_uuids = table_schema.rows.keys() self.result = [ diff --git a/ovsdbapp/native/connection.py b/ovsdbapp/native/connection.py index 37cfb7aa..1f362a6a 100644 --- a/ovsdbapp/native/connection.py +++ b/ovsdbapp/native/connection.py @@ -100,7 +100,8 @@ class Connection(object): @removals.removed_kwarg('table_name_list', **__rm_args) def start(self, table_name_list=None): - """ + """Start the connection. + :param table_name_list: A list of table names for schema_helper to register. When this parameter is given, schema_helper will only register tables which name are in list. Otherwise, @@ -141,8 +142,8 @@ class Connection(object): while True: self.idl.wait(self.poller) self.poller.fd_wait(self.txns.alert_fileno, poller.POLLIN) - #TODO(jlibosva): Remove next line once losing connection to ovsdb - # is solved. + # TODO(jlibosva): Remove next line once losing connection to ovsdb + # is solved. self.poller.timer_wait(self.timeout * 1000) self.poller.block() self.idl.run() diff --git a/ovsdbapp/native/helpers.py b/ovsdbapp/native/helpers.py index 943ba09a..12821574 100644 --- a/ovsdbapp/native/helpers.py +++ b/ovsdbapp/native/helpers.py @@ -14,6 +14,7 @@ import subprocess + def _connection_to_manager_uri(conn_uri): proto, addr = conn_uri.split(':', 1) if ':' in addr: diff --git a/ovsdbapp/native/idlutils.py b/ovsdbapp/native/idlutils.py index 6808ad72..c871ecfb 100644 --- a/ovsdbapp/native/idlutils.py +++ b/ovsdbapp/native/idlutils.py @@ -17,7 +17,6 @@ import os import time import uuid -from ovsdbapp import exceptions from ovs.db import idl from ovs import jsonrpc from ovs import poller @@ -26,6 +25,7 @@ import six import tenacity from ovsdbapp import api +from ovsdbapp import exceptions from ovsdbapp.native import helpers diff --git a/test-requirements.txt b/test-requirements.txt index 4a7d2041..ca84c9e1 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -9,6 +9,7 @@ python-subunit>=0.0.18 # Apache-2.0/BSD sphinx>=1.2.1,!=1.3b1,<1.4 # BSD oslosphinx>=4.7.0 # Apache-2.0 oslotest>=1.10.0 # Apache-2.0 +os-testr>=0.8.0 # Apache-2.0 testrepository>=0.0.18 # Apache-2.0/BSD testscenarios>=0.4 # Apache-2.0/BSD testtools>=1.4.0 # MIT diff --git a/tox.ini b/tox.ini index c8889926..4375ee63 100644 --- a/tox.ini +++ b/tox.ini @@ -10,7 +10,7 @@ setenv = VIRTUAL_ENV={envdir} PYTHONWARNINGS=default::DeprecationWarning deps = -r{toxinidir}/test-requirements.txt -commands = python setup.py test --slowest --testr-args='{posargs}' +commands = python setup.py testr --slowest --testr-args='{posargs}' [testenv:pep8] commands = flake8 {posargs}