Install Horizon from git repository in tox test

To test UI plugins, we should install recent Horizon
from master branch like CI infra does.

Also, this patch adds new testenv:py35dj20, due to
Horizon has plan to bump Django version to 2.0.

And new testenv:jstests for eslint and karma is added.

To run tox test easily before upload patchset,
adds py35dj20, jstests, docs and releasenotes to envlist.

Change-Id: I9f111c1d2a70e87f60e9901e6070d05e3dc1a76d
This commit is contained in:
Shu Muto 2018-03-29 11:10:08 +09:00
parent 67a7aafe84
commit 94d15f9eed

157
tox.ini
View File

@ -1,41 +1,154 @@
[tox]
envlist = pep8,py35,py27
envlist = pep8,py35,py35dj20,py27,jstests,docs,releasenotes
minversion = 2.3.2
skipsdist = True
[testenv]
usedevelop = True
setenv = VIRTUAL_ENV={envdir}
NOSE_WITH_OPENSTACK=1
NOSE_OPENSTACK_COLOR=1
NOSE_OPENSTACK_RED=0.05
NOSE_OPENSTACK_YELLOW=0.025
NOSE_OPENSTACK_SHOW_ELAPSED=1
PYTHONWARNINGS=default::DeprecationWarning
install_command = pip install -c{env:UPPER_CONSTRAINTS_FILE:https://git.openstack.org/cgit/openstack/requirements/plain/upper-constraints.txt} -U {opts} {packages}
deps = -r{toxinidir}/requirements.txt
-r{toxinidir}/test-requirements.txt
setenv =
VIRTUAL_ENV={envdir}
NOSE_WITH_OPENSTACK=1
NOSE_OPENSTACK_COLOR=1
NOSE_OPENSTACK_RED=0.05
NOSE_OPENSTACK_YELLOW=0.025
NOSE_OPENSTACK_SHOW_ELAPSED=1
PYTHONWARNINGS=default::DeprecationWarning
deps =
-c{env:UPPER_CONSTRAINTS_FILE:https://git.openstack.org/cgit/openstack/requirements/plain/upper-constraints.txt}
-r{toxinidir}/requirements.txt
-r{toxinidir}/test-requirements.txt
commands = python manage.py test {posargs} --settings=zun_ui.test.settings
[testenv:pep8]
commands = flake8 {posargs}
[testenv:venv]
commands = {posargs}
[testenv:cover]
commands = python setup.py test --coverage --testr-args='{posargs}'
[testenv:docs]
commands = python setup.py build_sphinx
[testenv:releasenotes]
commands = sphinx-build -a -E -d releasenotes/build/doctrees -b html releasenotes/source releasenotes/build/html
[testenv:pep8]
commands = flake8 {posargs}
[flake8]
exclude = .venv,.git,.tox,dist,*egg,build,node_modules
max-complexity = 20
[testenv:cover]
commands = python setup.py test --coverage --testr-args='{posargs}'
[testenv:py27]
whitelist_externals =
git
mv
rm
commands =
# Crean up env
rm -fr .tox/py27/src/
rm -fr .tox/py27-log/
# To test on local, re-install horizon from git like CI infra does.
git clone https://git.openstack.org/openstack/horizon.git .tox/py27/src/horizon
pip install -U -t .tox/py27/lib/python2.7/site-packages/ .tox/py27/src/horizon
# Run test
python manage.py test {posargs}
# To save disk space, clean up installed modules except log
mv .tox/py27/log/ .tox/py27-log/
rm -fr .tox/py27/
[testenv:py35]
basepython = python3.5
whitelist_externals =
git
mv
rm
commands =
# Crean up env
rm -fr .tox/py35/src/
rm -fr .tox/py35-log/
# To test on local, re-install horizon from git like CI infra does.
git clone https://git.openstack.org/openstack/horizon.git .tox/py35/src/horizon
pip install -U -t .tox/py35/lib/python3.5/site-packages/ .tox/py35/src/horizon
# Run test
python manage.py test {posargs}
# To save disk space, clean up installed modules except log
mv .tox/py35/log/ .tox/py35-log/
rm -fr .tox/py35/
[testenv:py35dj20]
basepython = python3.5
whitelist_externals =
git
mv
rm
commands =
# Crean up env
rm -fr .tox/py35dj20/src/
rm -fr .tox/py35dj20-log/
# To test on local, re-install horizon from git like CI infra does.
git clone https://git.openstack.org/openstack/horizon.git .tox/py35dj20/src/horizon
pip install -U -t .tox/py35dj20/lib/python3.5/site-packages/ .tox/py35dj20/src/horizon
# Run test
pip install django>=2.0,<2.1
python manage.py test {posargs}
# To save disk space, clean up installed modules except log
mv .tox/py35dj20/log/ .tox/py35dj20-log/
rm -fr .tox/py35dj20/
[testenv:jstests]
# jstests includes checks for eslint and karma test.
whitelist_externals =
npm
git
mv
rm
commands =
# Crean up env
rm -fr .tox/jstests/src/
rm -fr .tox/jstests-log/
# To test on local, re-install horizon from git like CI infra does.
git clone https://git.openstack.org/openstack/horizon.git .tox/jstests/src/horizon
pip install -U -t .tox/jstests/lib/python2.7/site-packages/ .tox/jstests/src/horizon
# Run test
npm install
npm run lint
npm run test
# clean up installed modules except log
mv .tox/jstests/log/ .tox/jstests-log/
rm -fr .tox/jstests/
rm -fr .tox/py27/
[testenv:docs]
whitelist_externals =
git
mv
rm
commands =
# Crean up env
rm -fr .tox/docs/src/
rm -fr .tox/docs-log/
# To test on local, re-install horizon from git like CI infra does.
git clone https://git.openstack.org/openstack/horizon.git .tox/docs/src/horizon
pip install -U -t .tox/docs/lib/python2.7/site-packages/ .tox/docs/src/horizon
# Run test
python setup.py build_sphinx
# To save disk space, clean up installed modules except log
mv .tox/docs/log/ .tox/docs-log/
rm -fr .tox/docs/
rm -fr .tox/py27/
[testenv:releasenotes]
whitelist_externals =
git
mv
rm
commands =
# Crean up env
rm -fr .tox/releasenotes/src/
rm -fr .tox/releasenotes-log/
# To test on local, re-install horizon from git like CI infra does.
git clone https://git.openstack.org/openstack/horizon.git .tox/releasenotes/src/horizon
pip install -U -t .tox/releasenotes/lib/python2.7/site-packages/ .tox/releasenotes/src/horizon
# Run test
sphinx-build -a -E -d releasenotes/build/doctrees -b html releasenotes/source releasenotes/build/html
# To save disk space, clean up installed modules except log
mv .tox/releasenotes/log/ .tox/releasenotes-log/
rm -fr .tox/releasenotes/
rm -fr .tox/py27/
[testenv:lower-constraints]
basepython = python3