Fix pep8/cookiecutter test running

This commit is contained in:
Terry Wilson 2017-02-24 15:32:17 -05:00
parent 81e6bf5393
commit e299f86d06
9 changed files with 25 additions and 15 deletions

8
.testr.conf Normal file
View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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 = [

View File

@ -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()

View File

@ -14,6 +14,7 @@
import subprocess
def _connection_to_manager_uri(conn_uri):
proto, addr = conn_uri.split(':', 1)
if ':' in addr:

View File

@ -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

View File

@ -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

View File

@ -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}