deb-horizon/tox.ini
Rob Cresswell 36d1d1ac68 Refactor tox & update docs
- Updated tox envlist, so just running `tox` from the CLI will now run all
voting gate tests

- Reduce duplicated definitions and commands

- Remove any reliance on run_tests within tox

- Removes all doc references to run_tests.sh, and replaces them
with their tox equivalent. Where necessary, language around the tox
commands has been altered or extended so that it makes sense and is
consistent with other parts of the docs. Also adds a new "Test Environment"
list to the docs, so that newcomers do not have to piece together CLI
commands and their cryptic extensions from tox.ini

- Move the inline shell scripting to its own file. Also fixes a bug when
passing args, since the logic assumed you were attempting a subset test
run (try `tox -e py27 -- --pdb` on master to compare)

- Moved translation tooling from run_tests to manage.py, w/ help text
and arg restrictions. This is much more flexible so that plugins can use
it without having to copy commands, but still defaults to exactly the
same parameters/behaviour from run_tests. Docs updated appropriately.

- Removed npm/karma strange reliance on either .venv or tox/py27. Now
it only uses tox/npm.

Change-Id: I883f885bd424955d39ddcfde5ba396a88cfc041e
Implements: blueprint enhance-tox
Closes-Bug: 1638672
2016-11-30 20:38:59 +00:00

151 lines
4.6 KiB
INI

[tox]
envlist = pep8,py27dj{18,19,110},py34,py35,releasenotes,npm
minversion = 2.3.2
skipsdist = True
[testenv]
install_command = pip install -c{env:UPPER_CONSTRAINTS_FILE:https://git.openstack.org/cgit/openstack/requirements/plain/upper-constraints.txt} {opts} {packages}
setenv =
VIRTUAL_ENV={envdir}
INTEGRATION_TESTS=0
NOSE_WITH_OPENSTACK=1
NOSE_OPENSTACK_SHOW_ELAPSED=1
whitelist_externals =
bash
deps =
-r{toxinidir}/requirements.txt
-r{toxinidir}/test-requirements.txt
commands =
docs: sphinx-build -W -b html doc/source doc/build/html
horizon: {envpython} {toxinidir}/manage.py test --settings=horizon.test.settings {posargs}
manage: {envpython} {toxinidir}/manage.py {posargs}
py27: {[unit_tests]commands}
py27dj18: {[unit_tests]commands}
py34: {[unit_tests]commands}
py35: {[unit_tests]commands}
openstack_dashboard: {envpython} {toxinidir}/manage.py test --settings=openstack_dashboard.test.settings {posargs}
releasenotes: sphinx-build -a -E -W -d releasenotes/build/doctrees -b html releasenotes/source releasenotes/build/html
runserver: {envpython} {toxinidir}/manage.py runserver {posargs}
venv: {posargs}
[testenv:py34]
setenv =
PYTHONUNBUFFERED = 1
{[testenv]setenv}
commands = {[unit_tests]commands}
[testenv:py35]
setenv =
PYTHONUNBUFFERED = 1
{[testenv]setenv}
commands = {[unit_tests]commands}
[testenv:py27dj19]
commands =
pip install -U django>=1.9,<1.10
{[unit_tests]commands}
[testenv:py27dj110]
commands =
pip install -U django>=1.10,<1.11
{[unit_tests]commands}
[unit_tests]
commands = bash {toxinidir}/tools/unit_tests.sh {envpython} {toxinidir} {posargs}
[testenv:pep8]
usedevelop = True
commands =
{envpython} {toxinidir}/manage.py extract_messages --check-only
flake8
[testenv:cover]
commands =
coverage erase
coverage run {toxinidir}/manage.py test horizon --settings=horizon.test.settings {posargs}
coverage run -a {toxinidir}/manage.py test openstack_dashboard --settings=openstack_dashboard.test.settings --exclude-dir=openstack_dashboard/test/integration_tests {posargs}
coverage xml
coverage html
[testenv:selenium]
setenv =
{[testenv]setenv}
WITH_SELENIUM=1
SKIP_UNITTESTS=1
commands = {[unit_tests]commands}
[testenv:selenium-headless]
setenv =
{[testenv]setenv}
SELENIUM_HEADLESS=1
WITH_SELENIUM=1
SKIP_UNITTESTS=1
commands = {[unit_tests]commands}
[testenv:selenium-phantomjs]
setenv =
{[testenv]setenv}
SELENIUM_PHANTOMJS=1
WITH_SELENIUM=1
SKIP_UNITTESTS=1
commands = {[unit_tests]commands}
[testenv:py27integration]
# Run integration tests only
passenv = AVCONV_INSTALLED
setenv =
PYTHONHASHSEED=0
INTEGRATION_TESTS=1
SELENIUM_HEADLESS=1
NOSE_WITH_OPENSTACK=1
NOSE_OPENSTACK_SHOW_ELAPSED=1
basepython = python2.7
commands = nosetests openstack_dashboard.test.integration_tests {posargs}
[testenv:npm]
commands =
nodeenv -p
npm install
npm run {posargs:test}
[testenv:tests_system_packages]
# Provide an environment for system packagers that dont want anything from pip
# Any extra deps needed for this env can be passed by setting TOX_EXTRA_DEPS
sitepackages = True
passenv = TOX_EXTRA_DEPS
# Sets deps to an empty list so nothing is installed from pip
deps =
commands =
pip install -U {env:TOX_EXTRA_DEPS:}
{[unit_tests]commands}
[flake8]
exclude = .venv,.git,.tox,dist,*lib/python*,*egg,build,panel_template,dash_template,local_settings.py,*/local/*,*/test/test_plugins/*,.ropeproject,node_modules
# H405 multi line docstring summary not separated with an empty line
ignore = H405
max-complexity = 20
[hacking]
local-check-factory = horizon.hacking.checks.factory
import_exceptions = collections.defaultdict,
collections.OrderedDict,
django.conf.settings,
django.conf.urls.include,
django.conf.urls.patterns,
django.conf.urls.url,
django.core.urlresolvers.reverse,
django.core.urlresolvers.reverse_lazy,
django.template.loader.render_to_string,
django.test.utils.override_settings,
django.utils.encoding.force_text,
django.utils.html.conditional_escape,
django.utils.html.escape,
django.utils.http.urlencode,
django.utils.safestring.mark_safe,
django.utils.translation.npgettext_lazy,
django.utils.translation.pgettext_lazy,
django.utils.translation.ugettext_lazy,
django.utils.translation.ungettext_lazy,
operator.attrgetter,
StringIO.StringIO