-
Notifications
You must be signed in to change notification settings - Fork 95
/
tox.ini
141 lines (129 loc) · 5.12 KB
/
tox.ini
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
[tox]
minversion = 2.3.1
skipsdist = True
envlist = pep8,py,ansible-lint,any-errors-fatal,cli,conflicts,plugin-registry,docs
# info: to run individual tests/ testcase,
# you can provide extra '-k' argument to py.test like:
# $ tox -e py -- -k interactive
[testenv]
usedevelop = True
# The tests should do more mocking instead of touching the fs espacially the $HOME
setenv =
VIRTUAL_ENV={envdir}
PYTHONDONTWRITEBYTECODE=1
VIRTUALENV_NO_DOWNLOAD=1
CCACHE_DIR={env:HOME}/.ccache
HOME={envdir}/fishfish
deps = -r{toxinidir}/test-requirements.txt
list_dependencies_command = python -m pip freeze --all
commands =
# keep the cleanup here to avoid devs getting failures when running tox
bash -c 'find {envdir} {toxinidir}/infrared {toxinidir}/tests -type d -name "__pycache__" -print0 | xargs -0 -r -I \{\} /bin/rm -rf "\{\}"'
python -m pytest tests/ {posargs}
whitelist_externals =
/bin/bash
/bin/rm
/usr/bin/bash
/usr/local/bin/bash
bash
find
git
make
xargs
[testenv:venv]
commands = {posargs}
[testenv:conflicts]
envdir = {toxworkdir}/conflicts
# this is an essential type of test that validates that installing infrared
# does not infroduce conflicts in python installed packages.
# This must work for both cases: installing with/without --upgrade
deps =
commands =
bash -c "PIP_LOG={envdir}/log/pip-conflicts-1.log python -m pip install -q 'pip>=10.0.1'"
- python -m pip check
bash -c "PIP_LOG={envdir}/log/pip-conflicts-2.log python -m pip install -q -e ."
python -m pip check
bash -c "PIP_LOG={envdir}/log/pip-conflicts-3.log python -m pip uninstall -q -y infrared"
bash -c "PIP_LOG={envdir}/log/pip-conflicts-4.log python -m pip install -q --upgrade -e ."
python -m pip check
[testenv:pep8]
# hacking pulls flake8, pep8 and more https://pypi.org/project/hacking/
envdir = {toxworkdir}/pep8
deps = hacking
usedevelop = False
skip_install = True
setenv =
PYTHONDONTWRITEBYTECODE=1
commands =
flake8 {posargs} infrared
# infrared param *must* be specified or flake8 will miss to parse some files
#[testenv:py3]
#envdir = {toxworkdir}/p3-shared
#basepython = python3
# You need to install selinux from a package now
#sitepackages = True
[testenv:ansible-lint]
envdir = {toxworkdir}/ansible-lint
usedevelop = False
skip_install = True
deps =
-r test-requirements.txt
-r requirements.txt
# both ansible-lint and yamllint use a single tox env to improve build speed and
# reduce disk space. Both are sharing lots of common requirements and most
# time is spend installing dependencies.
# run also release-notes yaml lint
setenv =
VIRTUALENV_NO_DOWNLOAD=1
ANSIBLE_LIBRARY={toxinidir}/infrared/common/library:/usr/share/ansible/plugins/modules
ANSIBLE_CALLBACK_PLUGINS={toxinidir}/infrared/common/callback_plugins:/usr/share/ansible/plugins/callback
ANSIBLE_FILTER_PLUGINS={toxinidir}/infrared/common/filter_plugins:/usr/share/ansible/plugins/filter
# This points at a non-existant file on purpose to ensure that ansible uses default parameters
ANSIBLE_CONFIG=/tmp/no-config.cfg
# ANSIBLE_CONFIG avoid the undesired case where tox->ansible would load user own ~/ansible.cfg (if any)
commands =
bash -c "git ls-tree --full-tree --name-only -r HEAD plugins | grep -E '\.ya?ml$' | xargs python -m yamllint"
bash -c "git ls-tree --full-tree --name-only -r HEAD releasenotes/notes | grep -E '\.ya?ml$' | xargs -r python -m yamllint"
bash -c "ansible-lint --force-color infrared/common/roles/*/ plugins/* plugins/*/roles/* plugins/tripleo-overcloud/roles/containers/*"
[testenv:any-errors-fatal]
envdir = {toxworkdir}/shared
deps = PyYAML
skip_install = True
usedevelop = False
# verbose output goes to stdout and errors go to stderr which is visible on console
commands = bash -c "git ls-tree --full-tree --name-only -r HEAD plugins | grep -E '\.ya?ml$' | ./tox-check-any_errors_fatal.py -v - >{envdir}/log/tox-check-any_errors_fatal.log"
[testenv:docs]
deps = -r{toxinidir}/docs/requirements.txt
commands = bash -c 'cd docs && make clean && make html'
[testenv:cli]
envdir = {toxworkdir}/cli
deps = {toxinidir}
setenv =
PYTHONDONTWRITEBYTECODE=1
PIP_LOG={envdir}/log/pip-cli.log
IR_HOME={envdir}/.infrared
install_command = python -m pip install -q --retries 10 {packages}
commands =
infrared plugin add all
# test if we can call infrared as a python module:
python -m infrared --version
# test that "setup.py --version" and "setup.py --name" do return only one line on stdout
bash -c "[[ $(python setup.py --version 2>/dev/null | wc -l) -eq 1 ]]"
bash -c "[[ $(python setup.py --name 2>/dev/null | wc -l) -eq 1 ]]"
[testenv:plugin-registry]
envdir = {toxworkdir}/shared
usedevelop = False
setenv =
PYTHONDONTWRITEBYTECODE=1
TARGET_BRANCH={env:GERRIT_BRANCH:}
skip_install = True
commands =
bash -c "if [[ $TARGET_BRANCH == master ]]; then ./tox-check-plugin_registry.py; fi"
[flake8]
# H102: Apache 2.0 license header not found
# W504 line break after binary operator
ignore = H102,W504
show-source = True
exclude = .git,.venv,.tox,dist,docs,*egg
max-line-length = 120
# 120 is standard ansible value, feel free to decrease it if you want.