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
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
|
[tox]
envlist = py3, xenial-dev, flake8, pylint
recreate = True
[testenv]
commands = {envpython} -m pytest {posargs:tests/unittests cloudinit}
setenv =
LC_ALL = en_US.utf-8
passenv=
PYTEST_ADDOPTS
[testenv:flake8]
basepython = python3
deps =
flake8==3.8.2
commands = {envpython} -m flake8 {posargs:cloudinit/ tests/ tools/}
# https://github.com/gabrielfalcao/HTTPretty/issues/223
setenv =
LC_ALL = en_US.utf-8
[testenv:pylint]
basepython = python3
deps =
# requirements
pylint==2.6.0
# test-requirements because unit tests are now present in cloudinit tree
-r{toxinidir}/test-requirements.txt
-r{toxinidir}/integration-requirements.txt
commands = {envpython} -m pylint {posargs:cloudinit tests --ignore=cloud_tests tools}
[testenv:py3]
basepython = python3
deps =
-r{toxinidir}/test-requirements.txt
commands = {envpython} -m pytest \
--durations 10 \
{posargs:--cov=cloudinit --cov-branch \
tests/unittests cloudinit}
[testenv:py27]
basepython = python2.7
deps = -r{toxinidir}/test-requirements.txt
[flake8]
# E226: missing whitespace around arithmetic operator
# W503: line break before binary operator
# W504: line break after binary operator
ignore=E226,W503,W504
exclude = .venv,.tox,dist,doc,*egg,.git,build,tools
per-file-ignores =
cloudinit/cmd/main.py:E402
[testenv:doc]
basepython = python3
deps =
-r{toxinidir}/doc-requirements.txt
commands =
{envpython} -m sphinx {posargs:doc/rtd doc/rtd_html}
doc8 doc/rtd
[xenial-shared-deps]
# The version of pytest in xenial doesn't work with Python 3.8, so we define
# two xenial environments: [testenv:xenial] runs the tests with exactly the
# version of pytest present in xenial, and is used in CI. [testenv:xenial-dev]
# runs the tests with the lowest version of pytest that works with Python 3.8,
# 3.0.7, but keeps the other dependencies at xenial's level.
#
# (This section is not a testenv, it is used to maintain a single definition of
# the dependencies shared between the two xenial testenvs.)
deps =
# requirements
jinja2==2.8
pyyaml==3.11
oauthlib==1.0.3
pyserial==3.0.1
configobj==5.0.6
requests==2.9.1
# test-requirements
pytest-catchlog==1.2.1
[testenv:xenial]
# When updating this commands definition, also update the definition in
# [testenv:xenial-dev]. See the comment there for details.
commands =
python ./tools/pipremove jsonschema
python -m pytest {posargs:tests/unittests cloudinit}
basepython = python3
deps =
# Refer to the comment in [xenial-shared-deps] for details
{[xenial-shared-deps]deps}
httpretty==0.8.6
jsonpatch==1.10
pytest==2.8.7
[testenv:xenial-dev]
# This should be:
# commands = {[testenv:xenial]commands}
# but the version of pytest in xenial has a bug
# (https://github.com/tox-dev/tox/issues/208) which means that the {posargs}
# substitution variable is misparsed and causes a traceback. Ensure that any
# changes here are reflected in [testenv:xenial].
commands =
python ./tools/pipremove jsonschema
python -m pytest {posargs:tests/unittests cloudinit}
basepython = {[testenv:xenial]basepython}
deps =
# Refer to the comment in [xenial-shared-deps] for details
{[xenial-shared-deps]deps}
# httpretty in xenial is 0.8.6, not 0.9.5. The oldest version to work with
# Python 3.7+ is 0.9.5, because it is the first to include this commit:
# https://github.com/gabrielfalcao/HTTPretty/commit/5776d97da3992b9071db5e21faf175f6e8729060
httpretty==0.9.5
# jsonpatch in xenial is 1.10, not 1.19 (#839779). The oldest version
# to work with python3.6 is 1.16 as found in Artful. To keep default
# invocation of 'tox' happy, accept the difference in version here.
jsonpatch==1.16
pytest==3.0.7
[testenv:tip-flake8]
commands = {envpython} -m flake8 {posargs:cloudinit/ tests/ tools/}
deps = flake8
[testenv:tip-pylint]
commands = {envpython} -m pylint {posargs:cloudinit tests --ignore=cloud_tests tools}
deps =
# requirements
pylint
# test-requirements
-r{toxinidir}/test-requirements.txt
-r{toxinidir}/integration-requirements.txt
[testenv:citest]
basepython = python3
commands = {envpython} -m tests.cloud_tests {posargs}
passenv = HOME TRAVIS
deps =
-r{toxinidir}/cloud-tests-requirements.txt
# Until Xenial tox support is dropped or bumps to tox:2.3.2, reflect changes to
# deps into testenv:integration-tests-ci: commands, passenv and deps.
# This is due to (https://github.com/tox-dev/tox/issues/208) which means that
# the {posargs} handling and substitutions won't do what we want until tox 2.3.2
# Once Xenial is dropped, integration-tests-ci can use proper substitution
# commands = {[testenv:integration-tests]commands}
[testenv:integration-tests]
basepython = python3
commands = {envpython} -m pytest --log-cli-level=INFO {posargs:tests/integration_tests}
passenv = CLOUD_INIT_* SSH_AUTH_SOCK OS_*
deps =
-r{toxinidir}/integration-requirements.txt
[testenv:integration-tests-ci]
commands = {envpython} -m pytest --log-cli-level=INFO {posargs:tests/integration_tests}
passenv = CLOUD_INIT_* SSH_AUTH_SOCK OS_*
deps =
-r{toxinidir}/integration-requirements.txt
setenv =
PYTEST_ADDOPTS="-m ci"
[pytest]
# TODO: s/--strict/--strict-markers/ once xenial support is dropped
testpaths = cloudinit tests/unittests
addopts = --strict
log_format = %(asctime)s %(levelname)-9s %(name)s:%(filename)s:%(lineno)d %(message)s
log_date_format = %Y-%m-%d %H:%M:%S
markers =
allow_subp_for: allow subp usage for the given commands (disable_subp_usage)
allow_all_subp: allow all subp usage (disable_subp_usage)
ci: run this integration test as part of CI test runs
ds_sys_cfg: a sys_cfg dict to be used by datasource fixtures
ec2: test will only run on EC2 platform
gce: test will only run on GCE platform
azure: test will only run on Azure platform
oci: test will only run on OCI platform
openstack: test will only run on openstack
lxd_config_dict: set the config_dict passed on LXD instance creation
lxd_container: test will only run in LXD container
lxd_use_exec: `execute` will use `lxc exec` instead of SSH
lxd_vm: test will only run in LXD VM
not_xenial: test cannot run on the xenial release
not_bionic: test cannot run on the bionic release
no_container: test cannot run in a container
user_data: the user data to be passed to the test instance
instance_name: the name to be used for the test instance
sru_2020_11: test is part of the 2020/11 SRU verification
sru_2021_01: test is part of the 2021/01 SRU verification
sru_next: test is part of the next SRU verification
ubuntu: this test should run on Ubuntu
unstable: skip this test because it is flakey
|