Fix tests
This commit is contained in:
parent
56173f841e
commit
64f399e8cd
4
.testr.conf
Normal file
4
.testr.conf
Normal file
@ -0,0 +1,4 @@
|
||||
[DEFAULT]
|
||||
test_command=OS_STDOUT_CAPTURE=1 OS_STDERR_CAPTURE=1 OS_LOG_CAPTURE=1 ${PYTHON:-python} -m subunit.run discover -t ./ ${OS_TEST_PATH:-./wan_qos/tests/unit} $LISTOPT $IDOPTION | cat
|
||||
test_id_option=--load-list $IDFILE
|
||||
test_list_option=--list
|
25
requirements.txt
Normal file
25
requirements.txt
Normal file
@ -0,0 +1,25 @@
|
||||
# The order of packages is significant, because pip processes them in the order
|
||||
# of appearance. Changing the order has an impact on the overall integration
|
||||
# process, which may cause wedges in the gate later.
|
||||
|
||||
pbr>=2.0.0 # Apache-2.0
|
||||
Babel>=2.3.4 # BSD
|
||||
kazoo>=2.2 # Apache-2.0
|
||||
ovs>=2.7.0 # Apache-2.0
|
||||
pyzmq>=14.3.1 # LGPL+BSD
|
||||
ryu>=4.9 # Apache-2.0
|
||||
SQLAlchemy!=1.1.5,!=1.1.6,!=1.1.7,!=1.1.8,>=1.0.10 # MIT
|
||||
alembic>=0.8.10 # MIT
|
||||
neutron-lib>=1.3.0 # Apache-2.0
|
||||
oslo.config>=3.22.0 # Apache-2.0
|
||||
oslo.db>=4.19.0 # Apache-2.0
|
||||
oslo.i18n>=2.1.0 # Apache-2.0
|
||||
oslo.log>=3.22.0 # Apache-2.0
|
||||
oslo.reports>=0.6.0 # Apache-2.0
|
||||
oslo.serialization>=1.10.0 # Apache-2.0
|
||||
crc16>=0.1.1 # LGPLv3+
|
||||
netaddr!=0.7.16,>=0.7.13 # BSD
|
||||
six>=1.9.0 # MIT
|
||||
httplib2>=0.7.5 # MIT
|
||||
WebOb>=1.7.1 # MIT
|
||||
|
14
test-requirements.txt
Normal file
14
test-requirements.txt
Normal file
@ -0,0 +1,14 @@
|
||||
# The order of packages is significant, because pip processes them in the order
|
||||
# of appearance. Changing the order has an impact on the overall integration
|
||||
# process, which may cause wedges in the gate later.
|
||||
|
||||
hacking!=0.13.0,<0.14,>=0.12.0 # Apache-2.0
|
||||
|
||||
mock>=2.0 # BSD
|
||||
python-subunit>=0.0.18 # Apache-2.0/BSD
|
||||
os-testr>=0.8.0 # Apache-2.0
|
||||
oslotest>=1.10.0 # Apache-2.0
|
||||
testrepository>=0.0.18 # Apache-2.0/BSD
|
||||
testresources>=0.2.4 # Apache-2.0/BSD
|
||||
testscenarios>=0.4 # Apache-2.0/BSD
|
||||
testtools>=1.4.0 # MIT
|
53
tools/tox_install.sh
Executable file
53
tools/tox_install.sh
Executable file
@ -0,0 +1,53 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Many of neutron's repos suffer from the problem of depending on neutron,
|
||||
# but it not existing on pypi.
|
||||
|
||||
# This wrapper for tox's package installer will use the existing package
|
||||
# if it exists, else use zuul-cloner if that program exists, else grab it
|
||||
# from neutron master via a hard-coded URL. That last case should only
|
||||
# happen with devs running unit tests locally.
|
||||
|
||||
# From the tox.ini config page:
|
||||
# install_command=ARGV
|
||||
# default:
|
||||
# pip install {opts} {packages}
|
||||
|
||||
ZUUL_CLONER=/usr/zuul-env/bin/zuul-cloner
|
||||
neutron_installed=$(echo "import neutron" | python 2>/dev/null ; echo $?)
|
||||
BRANCH_NAME=master
|
||||
|
||||
set -ex
|
||||
|
||||
cwd=$(/bin/pwd)
|
||||
|
||||
CONSTRAINTS_FILE=$1
|
||||
shift
|
||||
|
||||
install_cmd="pip install"
|
||||
if [ $CONSTRAINTS_FILE != "unconstrained" ]; then
|
||||
install_cmd="$install_cmd -c$CONSTRAINTS_FILE"
|
||||
fi
|
||||
|
||||
if [ $neutron_installed -eq 0 ]; then
|
||||
echo "ALREADY INSTALLED" > /tmp/tox_install.txt
|
||||
echo "Neutron already installed; using existing package"
|
||||
elif [ -x "$ZUUL_CLONER" ]; then
|
||||
echo "ZUUL CLONER" > /tmp/tox_install.txt
|
||||
cd /tmp
|
||||
export ZUUL_BRANCH=${ZUUL_BRANCH-$BRANCH}
|
||||
$ZUUL_CLONER --cache-dir \
|
||||
/opt/git \
|
||||
--branch $BRANCH_NAME \
|
||||
git://git.openstack.org \
|
||||
openstack/neutron
|
||||
cd openstack/neutron
|
||||
$install_cmd -e .
|
||||
cd "$cwd"
|
||||
else
|
||||
echo "PIP HARDCODE" > /tmp/tox_install.txt
|
||||
$install_cmd -U -egit+https://git.openstack.org/openstack/neutron@$BRANCH_NAME#egg=neutron
|
||||
fi
|
||||
|
||||
$install_cmd -U $*
|
||||
exit $?
|
51
tox.ini
Normal file
51
tox.ini
Normal file
@ -0,0 +1,51 @@
|
||||
[tox]
|
||||
minversion = 1.6
|
||||
envlist = pep8,py27,py35
|
||||
skipsdist = True
|
||||
|
||||
[testenv]
|
||||
# Note the hash seed is set to 0 until neutron can be tested with a
|
||||
# random hash seed successfully.
|
||||
setenv = VIRTUAL_ENV={envdir}
|
||||
PYTHONHASHSEED=0
|
||||
PYTHONWARNINGS=default::DeprecationWarning
|
||||
usedevelop = True
|
||||
install_command = {toxinidir}/tools/tox_install.sh {env:UPPER_CONSTRAINTS_FILE:https://git.openstack.org/cgit/openstack/requirements/plain/upper-constraints.txt} {opts} {packages}
|
||||
deps = -r{toxinidir}/requirements.txt
|
||||
-r{toxinidir}/test-requirements.txt
|
||||
whitelist_externals = sh
|
||||
commands =
|
||||
ostestr '{posargs}'
|
||||
# sh tools/pretty_tox.sh '{posargs}'
|
||||
|
||||
[testenv:pep8]
|
||||
commands =
|
||||
flake8
|
||||
neutron-db-manage --subproject dragonflow check_migration
|
||||
|
||||
[testenv:venv]
|
||||
commands = {posargs}
|
||||
|
||||
[flake8]
|
||||
# E126 continuation line over-indented for hanging indent
|
||||
# H404 multi line docstring should start with a summary
|
||||
# H405 multi line docstring summary not separated with an empty line
|
||||
# N530 Direct neutron imports not allowed
|
||||
# N531 log message does not translate
|
||||
ignore = E126,H404,H405,N530,N531
|
||||
# H904: Delay string interpolations at logging calls
|
||||
# H203: Use assertIs(Not)None to check for None
|
||||
enable-extensions=H904,H203
|
||||
show-source = true
|
||||
exclude = ./.*,dist,doc,build,tools
|
||||
|
||||
[testenv:pylint]
|
||||
deps =
|
||||
{[testenv]deps}
|
||||
pylint
|
||||
commands =
|
||||
pylint --rcfile=.pylintrc --output-format=colorized {posargs:neutron}
|
||||
|
||||
[hacking]
|
||||
#import_exceptions = wan_qos._i18n
|
||||
local-check-factory = neutron_lib.hacking.checks.factory
|
@ -15,8 +15,8 @@
|
||||
|
||||
import threading
|
||||
|
||||
from neutron import context as ctx
|
||||
from neutron_lib import exceptions
|
||||
from neutron_lib import context as ctx
|
||||
from oslo_log import log as logging
|
||||
from oslo_utils import timeutils
|
||||
from oslo_utils import uuidutils
|
||||
|
@ -1,5 +1,5 @@
|
||||
from neutron import context as ctx
|
||||
from neutron.tests.unit import testlib_api
|
||||
from neutron_lib import context as ctx
|
||||
|
||||
from wan_qos.db import wan_qos_db
|
||||
from wan_qos.services import plugin
|
||||
|
Loading…
x
Reference in New Issue
Block a user