forked from redhat-openstack/infrared
-
Notifications
You must be signed in to change notification settings - Fork 0
/
tox.ini
166 lines (152 loc) · 7.18 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
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
[tox]
minversion = 2.3.1
skipsdist = True
envlist = py27,pep8,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 py27 -- -k interactive
[testenv]
basepython = python2
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
commands =
# keep the cleanup here to avoid devs getting failures when running tox
find . -type f -name "*.pyc" -delete
find . -type d -name "__pycache__" -delete
python -m pytest tests/ {posargs}
whitelist_externals =
bash
find
git
/bin/bash
/usr/bin/bash
/usr/local/bin/bash
make
[testenv:conflicts]
envdir = {toxworkdir}/p27-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}/p27-pep8
deps = hacking
usedevelop = False
skip_install = True
commands =
flake8 {posargs} infrared
# infrared param *must* be specified or flake8 will miss to parse some files
[testenv:py36]
envdir = {toxworkdir}/p36-shared
basepython = python3.6
# You need to install selinux from a package now
sitepackages = True
[testenv:ansible-lint]
envdir = {toxworkdir}/p27-ansible-lint
# ANSIBLE0002: Trailing whitespace
# There should not be any trailing whitespace
# ANSIBLE0004: Git checkouts must contain explicit version
# All version control checkouts must point to an explicit commit or tag, not just "latest"
# ANSIBLE0005: Mercurial checkouts must contain explicit revision
# All version control checkouts must point to an explicit commit or tag, not just "latest"
# ANSIBLE0006: Using command rather than module
# Executing a command when there is an Ansible module is generally a bad idea
# ANSIBLE0007: Using command rather than an argument to e.g. file
# Executing a command when there is are arguments to modules is generally a bad idea
# ANSIBLE0008: Deprecated sudo
# Instead of sudo/sudo_user, use become/become_user.
# ANSIBLE0009: Octal file permissions must contain leading zero
# Numeric file permissions without leading zero can behavein unexpected ways. See http://docs.ansible.com/ansible/file_module.html
# ANSIBLE0010: Package installs should not use latest
# Package installs should use state=present with or without a version
# ANSIBLE0011: All tasks should be named
# All tasks should have a distinct name for readability and for --start-at-task to work
# ANSIBLE0012: Commands should not change things if nothing needs doing
# Commands should either read information (and thus set changed_when) or not do something
# if it has already been done (using creates/removes) or only do it if another check has a particular result (when)
# ANSIBLE0013: Use shell only when shell functionality is required
# Shell should only be used when piping, redirecting or chaining commands (and Ansible would be preferred for some of those!)
# ANSIBLE0014: Environment variables don't work as part of command
# Environment variables should be passed to shell or command through environment argument
# ANSIBLE0015: Using bare variables is deprecated
# Using bare variables is deprecated. Update yourplaybooks so that the environment value uses the full variablesyntax ("{{your_variable}}").
# ANSIBLE0016: Tasks that run when changed should likely be handlers
# If a task has a `when: result.changed` setting, it's effectively acting as a handler
# ANSIBLE0017: become_user requires become to work as expected
# become_user without become will not actually change user
usedevelop = False
skip_install = True
deps = -rtest-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_CONFIG={toxinidir}/ansible-template.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 "git ls-tree --full-tree --name-only -r HEAD plugins | grep -E '\.ya?ml$' | xargs ansible-lint --force-color"
[testenv:any-errors-fatal]
envdir = {toxworkdir}/p27-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}/p27-cli
deps = {toxinidir}
setenv =
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}/p27-shared
usedevelop = False
setenv =
TARGET_BRANCH={env:GERRIT_BRANCH:}
skip_install = True
commands =
bash -c "if [[ $TARGET_BRANCH == master ]]; then ./tox-check-plugin_registry.py; fi"
[flake8]
envdir = {toxworkdir}/p27-shared
# E125 is a won't fix until https://github.com/jcrocholl/pep8/issues/126 is resolved. For further detail see https://review.openstack.org/#/c/36788/
# E123 skipped because it is ignored by default in the default pep8
# E129 skipped because it is too limiting when combined with other rules
# H404,H405,H101,H102,H233,H306,H401,H301,H236 Skipped until they gets fixed
ignore = E125,E123,E129,H404,H405,H101,H102,H233,H306,H401,H301,H236,D
show-source = True
exclude = .git,.venv,.tox,dist,docs,*egg,plugins/octario,plugins/gabbi
max-line-length = 120
# 120 is standard ansible value, feel free to decrease it if you want.
[testenv:venv]
commands = {posargs}