1[tox]
2minversion = 2.2
3envlist = linters, docs, docs-linkcheck, py34, py35, py36, py37, py38, py27, cover
4skip_missing_interpreters = true
5# custom vars (no meaning to tox)
6install_test_deps = pip install -q -r test-requirements.txt
7
8[testenv]
9setenv =
10         LANG=en_US.UTF-8
11         PYTHONDONTWRITEBYTECODE=1
12         SUBUNIT_FORMATTER=tee testr_subunit_log
13         VIRTUAL_ENV={envdir}
14usedevelop = True
15install_command = pip install {opts} {packages}
16# cleanup is needed mostly for dev environmnts and assures that if  dev
17# is switching branch, no lefovers will impact execution.
18# No git commands here because test should run even from a source archive.
19commands =
20    {[tox]install_test_deps}
21    - find . -type f -name "*.pyc" -delete
22    - find . -type d -name "__pycache__" -delete
23    # test that we can call jjb using both variants with same results
24    bash {toxinidir}/tools/test-commands.sh
25    stestr run --slowest {posargs}
26whitelist_externals =
27    bash
28    find
29
30[testenv:tips]
31# tests what happens with unreleased version of dependencies, like python-jenkins
32install_command = pip install -U {opts} {packages}
33commands =
34    bash -c "if [ -d {toxinidir}/../python-jenkins ]; then \
35    pip install -q -U -e 'git+file://{toxinidir}/../python-jenkins#egg=python-jenkins' ; else \
36    pip install -q -U -e 'git+https://git.openstack.org/openstack/python-jenkins@master#egg=python-jenkins' ; fi "
37    stestr run --slowest {posargs}
38
39[testenv:cover]
40setenv =
41    {[testenv]setenv}
42    PYTHON=coverage run --source jenkins_jobs --parallel-mode
43commands =
44    {[tox]install_test_deps}
45    stestr run {posargs}
46    coverage combine
47    coverage html -d cover
48    coverage xml -o cover/coverage.xml
49
50[testenv:linters]
51basepython = python3
52deps =
53    pre-commit>=1.12.0
54commands =
55    python -m pre_commit run --all
56
57# points to linters, kept only for developer convenience
58[testenv:pep8]
59envdir={toxworkdir}/linters
60deps={[testenv:linters]deps}
61commands = {[testenv:linters]commands}
62
63[testenv:pyflakes]
64deps = pyflakes
65commands = pyflakes jenkins_jobs tests setup.py
66
67[testenv:compare-xml-config]
68commands = jenkins-jobs {posargs:test -o .test/run-conf/default/out/ .test/run-conf/config/}
69
70[testenv:compare-xml-old]
71commands = jenkins-jobs test -o .test/old/out/ .test/old/config/
72
73[testenv:compare-xml-new]
74commands = jenkins-jobs test -o .test/new/out/ .test/new/config/
75
76[testenv:docs]
77commands =
78    {[tox]install_test_deps}
79    sphinx-build -n -W -b html -d doc/build/doctrees doc/source doc/build/html
80
81[testenv:docs-linkcheck]
82# If you are behind a proxy, for this test to work you will need to set
83# TOX_TESTENV_PASSENV="http_proxy https_proxy no_proxy ..." to pass
84# through the proxy environment settings to be able to validate any urls.
85commands =
86    {[tox]install_test_deps}
87    sphinx-build -n -W -b linkcheck -d doc/build/doctrees doc/source doc/build/linkcheck
88
89[testenv:venv]
90commands = {posargs}
91