add py27-dev and pep8-dev tox targets

This patch adds the py27-dev and pep8-dev tox targets that enable local
(outside the gate) running of py27 and pep8 using master branches from
our sub-project dependencies as discussed in [1] in editable mode.
If additional local/dev targets are needed (ex functional) they can be
added in the same fashion as shown herein.

With this patch to run pep8 locally use:
   tox -e pep8-dev

And to run py27 locally:
   tox -e py27-dev

The editable projects will be under .tox/{env}/src/

This patch also adds to our devstack/lib scripts by cleaning out any
existing (dependency git) projects and installing them in editable mode
from git.

Depends-On: https://review.openstack.org/552865
Depends-On: https://review.openstack.org/554297

[1] http://lists.openstack.org/pipermail/openstack-dev/2018-March/128328.html

Change-Id: I4d0dcba15e5b30e4cfa7335edf9c2dd961530184
This commit is contained in:
Boden R 2018-03-21 11:54:41 -06:00
parent 4c0802d796
commit d48a790378
3 changed files with 93 additions and 3 deletions

View File

@ -30,6 +30,22 @@ function _nsxv_ini_set {
} }
function nsxv_configure_service { function nsxv_configure_service {
# TODO(boden): find a better way to use master branch dependencies in devstack
sudo rm -rf /usr/local/lib/python2.7/dist-packages/networking_l2gw*
sudo pip install -e "git+https://git.openstack.org/openstack/networking-l2gw#egg=networking_l2gw"
sudo rm -rf /usr/local/lib/python2.7/dist-packages/networking_sfc*
sudo pip install -e "git+https://git.openstack.org/openstack/networking-sfc#egg=networking_sfc"
sudo rm -rf /usr/local/lib/python2.7/dist-packages/neutron_lbaas*
sudo pip install -e "git+https://git.openstack.org/openstack/neutron-lbaas#egg=neutron_lbaas"
sudo rm -rf /usr/local/lib/python2.7/dist-packages/neutron_fwaas*
sudo pip install -e "git+https://git.openstack.org/openstack/neutron-fwaas#egg=neutron_fwaas"
sudo rm -rf /usr/local/lib/python2.7/dist-packages/neutron_dynamic_routing*
sudo pip install -e "git+https://git.openstack.org/openstack/neutron-dynamic-routing#egg=neutron_dynamic_routing"
sudo rm -rf /usr/local/lib/python2.7/dist-packages/neutron_vpnaas*
sudo pip install -e "git+https://git.openstack.org/openstack/neutron-vpnaas#egg=neutron_vpnaas"
sudo rm -rf /usr/local/lib/python2.7/dist-packages/vmware_nsxlib*
sudo pip install -e "git+https://git.openstack.org/openstack/vmware-nsxlib#egg=vmware_nsxlib"
if [[ "$NSX_L2GW_DRIVER" != "" ]]; then if [[ "$NSX_L2GW_DRIVER" != "" ]]; then
iniset /$Q_PLUGIN_CONF_FILE DEFAULT nsx_l2gw_driver $NSX_L2GW_DRIVER iniset /$Q_PLUGIN_CONF_FILE DEFAULT nsx_l2gw_driver $NSX_L2GW_DRIVER
fi fi
@ -92,6 +108,22 @@ function _nsxv3_ini_set {
} }
function nsxv3_configure_service { function nsxv3_configure_service {
# TODO(boden): find a better way to use master branch dependencies in devstack
sudo rm -rf /usr/local/lib/python2.7/dist-packages/networking_l2gw*
sudo pip install -e "git+https://git.openstack.org/openstack/networking-l2gw#egg=networking_l2gw"
sudo rm -rf /usr/local/lib/python2.7/dist-packages/networking_sfc*
sudo pip install -e "git+https://git.openstack.org/openstack/networking-sfc#egg=networking_sfc"
sudo rm -rf /usr/local/lib/python2.7/dist-packages/neutron_lbaas*
sudo pip install -e "git+https://git.openstack.org/openstack/neutron-lbaas#egg=neutron_lbaas"
sudo rm -rf /usr/local/lib/python2.7/dist-packages/neutron_fwaas*
sudo pip install -e "git+https://git.openstack.org/openstack/neutron-fwaas#egg=neutron_fwaas"
sudo rm -rf /usr/local/lib/python2.7/dist-packages/neutron_dynamic_routing*
sudo pip install -e "git+https://git.openstack.org/openstack/neutron-dynamic-routing#egg=neutron_dynamic_routing"
sudo rm -rf /usr/local/lib/python2.7/dist-packages/neutron_vpnaas*
sudo pip install -e "git+https://git.openstack.org/openstack/neutron-vpnaas#egg=neutron_vpnaas"
sudo rm -rf /usr/local/lib/python2.7/dist-packages/vmware_nsxlib*
sudo pip install -e "git+https://git.openstack.org/openstack/vmware-nsxlib#egg=vmware_nsxlib"
if [[ $1 == "nsx_v3" ]]; then if [[ $1 == "nsx_v3" ]]; then
_nsxv3_ini_set default_overlay_tz $DEFAULT_OVERLAY_TZ_UUID "The VMware NSX plugin won't work without a default transport zone." _nsxv3_ini_set default_overlay_tz $DEFAULT_OVERLAY_TZ_UUID "The VMware NSX plugin won't work without a default transport zone."
else else

View File

@ -112,6 +112,21 @@ function neutron_plugin_create_nova_conf {
function neutron_plugin_install_agent_packages { function neutron_plugin_install_agent_packages {
# VMware NSX Plugin does not run q-agt, but it currently needs dhcp and metadata agents # VMware NSX Plugin does not run q-agt, but it currently needs dhcp and metadata agents
_neutron_ovs_base_install_agent_packages _neutron_ovs_base_install_agent_packages
# TODO(boden): find a better way to use master branch dependencies in devstack
sudo rm -rf /usr/local/lib/python2.7/dist-packages/networking_l2gw*
sudo pip install -e "git+https://git.openstack.org/openstack/networking-l2gw#egg=networking_l2gw"
sudo rm -rf /usr/local/lib/python2.7/dist-packages/networking_sfc*
sudo pip install -e "git+https://git.openstack.org/openstack/networking-sfc#egg=networking_sfc"
sudo rm -rf /usr/local/lib/python2.7/dist-packages/neutron_lbaas*
sudo pip install -e "git+https://git.openstack.org/openstack/neutron-lbaas#egg=neutron_lbaas"
sudo rm -rf /usr/local/lib/python2.7/dist-packages/neutron_fwaas*
sudo pip install -e "git+https://git.openstack.org/openstack/neutron-fwaas#egg=neutron_fwaas"
sudo rm -rf /usr/local/lib/python2.7/dist-packages/neutron_dynamic_routing*
sudo pip install -e "git+https://git.openstack.org/openstack/neutron-dynamic-routing#egg=neutron_dynamic_routing"
sudo rm -rf /usr/local/lib/python2.7/dist-packages/neutron_vpnaas*
sudo pip install -e "git+https://git.openstack.org/openstack/neutron-vpnaas#egg=neutron_vpnaas"
sudo rm -rf /usr/local/lib/python2.7/dist-packages/vmware_nsxlib*
sudo pip install -e "git+https://git.openstack.org/openstack/vmware-nsxlib#egg=vmware_nsxlib"
} }
function neutron_plugin_configure_common { function neutron_plugin_configure_common {

49
tox.ini
View File

@ -11,12 +11,12 @@ usedevelop = True
deps = -c{env:UPPER_CONSTRAINTS_FILE:https://git.openstack.org/cgit/openstack/requirements/plain/upper-constraints.txt} deps = -c{env:UPPER_CONSTRAINTS_FILE:https://git.openstack.org/cgit/openstack/requirements/plain/upper-constraints.txt}
-r{toxinidir}/requirements.txt -r{toxinidir}/requirements.txt
-r{toxinidir}/test-requirements.txt -r{toxinidir}/test-requirements.txt
whitelist_externals = sh whitelist_externals =
sh
stestr
commands = commands =
stestr run {posargs} stestr run {posargs}
stestr slowest stestr slowest
# there is also secret magic in ostestr which lets you run in a fail only
# mode. To do this define the TRACE_FAILONLY environmental variable.
[testenv:common] [testenv:common]
# Fake job to define environment variables shared between dsvm/non-dsvm jobs # Fake job to define environment variables shared between dsvm/non-dsvm jobs
@ -56,6 +56,24 @@ commands = sphinx-build -a -E -W -d releasenotes/build/doctrees -b html releasen
[testenv:py27] [testenv:py27]
setenv = OS_FAIL_ON_MISSING_DEPS=1 setenv = OS_FAIL_ON_MISSING_DEPS=1
[testenv:py27-dev]
# run py27 locally (not in the gate) using editable mode
# https://pip.pypa.io/en/stable/reference/pip_install/#editable-installs
# note that order is important to ensure dependencies don't override
commands =
pip install -q -e "git+https://git.openstack.org/openstack/networking-l2gw#egg=networking_l2gw"
pip install -q -e "git+https://git.openstack.org/openstack/networking-sfc#egg=networking_sfc"
pip install -q -e "git+https://git.openstack.org/openstack/neutron-lbaas#egg=neutron_lbaas"
pip install -q -e "git+https://git.openstack.org/openstack/neutron-fwaas#egg=neutron_fwaas"
pip install -q -e "git+https://git.openstack.org/openstack/neutron-dynamic-routing#egg=neutron_dynamic_routing"
pip install -q -e "git+https://git.openstack.org/openstack/neutron-vpnaas#egg=neutron_vpnaas"
pip install -q -e "git+https://git.openstack.org/openstack/vmware-nsxlib#egg=vmware_nsxlib"
pip install -q -e "git+https://git.openstack.org/openstack/neutron#egg=neutron"
pip freeze
stestr run {posargs}
whitelist_externals =
stestr
[testenv:pep8] [testenv:pep8]
basepython = python2.7 basepython = python2.7
commands = commands =
@ -70,6 +88,31 @@ whitelist_externals =
sh sh
bash bash
[testenv:pep8-dev]
# run pep8 locally (not in the gate) using editable mode
# https://pip.pypa.io/en/stable/reference/pip_install/#editable-installs
# note that order is important to ensure dependencies don't override
basepython = python2.7
commands =
pip install -q -e "git+https://git.openstack.org/openstack/networking-l2gw#egg=networking_l2gw"
pip install -q -e "git+https://git.openstack.org/openstack/networking-sfc#egg=networking_sfc"
pip install -q -e "git+https://git.openstack.org/openstack/neutron-lbaas#egg=neutron_lbaas"
pip install -q -e "git+https://git.openstack.org/openstack/neutron-fwaas#egg=neutron_fwaas"
pip install -q -e "git+https://git.openstack.org/openstack/neutron-dynamic-routing#egg=neutron_dynamic_routing"
pip install -q -e "git+https://git.openstack.org/openstack/neutron-vpnaas#egg=neutron_vpnaas"
pip install -q -e "git+https://git.openstack.org/openstack/vmware-nsxlib#egg=vmware_nsxlib"
pip install -q -e "git+https://git.openstack.org/openstack/neutron#egg=neutron"
pip freeze
# If it is easier to add a check via a shell script, consider adding it in this file
sh ./tools/misc-sanity-checks.sh
# Checks for coding and style guidelines
flake8 {toxinidir}/vmware_nsx
sh ./tools/coding-checks.sh --pylint '{posargs}'
neutron-db-manage --subproject vmware-nsx check_migration
{[testenv:genconfig]commands}
whitelist_externals =
sh
[testenv:bandit] [testenv:bandit]
commands = bandit -r vmware_nsx -n 5 -ll commands = bandit -r vmware_nsx -n 5 -ll