summaryrefslogtreecommitdiff
path: root/tox.ini
diff options
context:
space:
mode:
Diffstat (limited to 'tox.ini')
-rw-r--r--tox.ini144
1 files changed, 72 insertions, 72 deletions
diff --git a/tox.ini b/tox.ini
index 8612f034..a92c63e0 100644
--- a/tox.ini
+++ b/tox.ini
@@ -1,19 +1,19 @@
[tox]
-envlist = py3, xenial, pycodestyle, pyflakes, pylint
+envlist = py3, xenial-dev, flake8, pylint
recreate = True
[testenv]
-commands = python -m nose {posargs:tests/unittests cloudinit}
+commands = {envpython} -m pytest {posargs:tests/unittests cloudinit}
setenv =
LC_ALL = en_US.utf-8
passenv=
- NOSE_VERBOSE
+ PYTEST_ADDOPTS
-[testenv:pycodestyle]
+[testenv:flake8]
basepython = python3
deps =
- pycodestyle==2.4.0
-commands = {envpython} -m pycodestyle {posargs:cloudinit/ tests/ tools/}
+ flake8==3.8.2
+commands = {envpython} -m flake8 {posargs:cloudinit/ tests/ tools/}
# https://github.com/gabrielfalcao/HTTPretty/issues/223
setenv =
@@ -23,7 +23,7 @@ setenv =
basepython = python3
deps =
# requirements
- pylint==2.3.1
+ 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
@@ -32,27 +32,24 @@ commands = {envpython} -m pylint {posargs:cloudinit tests tools}
[testenv:py3]
basepython = python3
deps =
- nose-timer
-r{toxinidir}/test-requirements.txt
-commands = {envpython} -m nose --with-timer --timer-top-n 10 \
- {posargs:--with-coverage --cover-erase --cover-branches \
- --cover-inclusive --cover-package=cloudinit \
+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
-[testenv:py26]
-deps = -r{toxinidir}/test-requirements.txt
-commands = nosetests {posargs:tests/unittests cloudinit}
-setenv =
- LC_ALL = C
-
[flake8]
-#H102 Apache 2.0 license header not found
-ignore=H404,H405,H105,H301,H104,H403,H101,H102,H106,H304
+# 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
@@ -62,11 +59,15 @@ commands =
{envpython} -m sphinx {posargs:doc/rtd doc/rtd_html}
doc8 doc/rtd
-[testenv:xenial]
-commands =
- python ./tools/pipremove jsonschema
- python -m nose {posargs:tests/unittests cloudinit}
-basepython = python3
+[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
@@ -75,59 +76,50 @@ deps =
pyserial==3.0.1
configobj==5.0.6
requests==2.9.1
- # 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
- six==1.10.0
# test-requirements
- httpretty==0.9.6
- mock==1.3.0
- nose==1.3.7
- unittest2==1.1.0
- contextlib2==0.5.1
+ pytest-catchlog==1.2.1
-[testenv:centos6]
-basepython = python2.6
-commands = nosetests {posargs:tests/unittests cloudinit}
+[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 =
- # requirements
- argparse==1.2.1
- jinja2==2.2.1
- pyyaml==3.10
- oauthlib==0.6.0
- configobj==4.6.0
- requests==2.6.0
- jsonpatch==1.2
- six==1.9.0
- -r{toxinidir}/test-requirements.txt
-
-[testenv:opensusel150]
-basepython = python2.7
-commands = nosetests {posargs:tests/unittests cloudinit}
+ # 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 =
- # requirements
- jinja2==2.10
- PyYAML==3.12
- oauthlib==2.0.6
- configobj==5.0.6
- requests==2.18.4
+ # 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
- six==1.11.0
- -r{toxinidir}/test-requirements.txt
+ pytest==3.0.7
-[testenv:tip-pycodestyle]
-commands = {envpython} -m pycodestyle {posargs:cloudinit/ tests/ tools/}
-deps = pycodestyle
-
-[testenv:pyflakes]
-commands = {envpython} -m pyflakes {posargs:cloudinit/ tests/ tools/}
-deps =
- pyflakes==1.6.0
-
-[testenv:tip-pyflakes]
-commands = {envpython} -m pyflakes {posargs:cloudinit/ tests/ tools/}
-deps = pyflakes
+[testenv:tip-flake8]
+commands = {envpython} -m flake8 {posargs:cloudinit/ tests/ tools/}
+deps = flake8
[testenv:tip-pylint]
commands = {envpython} -m pylint {posargs:cloudinit tests tools}
@@ -141,6 +133,14 @@ deps =
[testenv:citest]
basepython = python3
commands = {envpython} -m tests.cloud_tests {posargs}
-passenv = HOME
+passenv = HOME TRAVIS
deps =
-r{toxinidir}/integration-requirements.txt
+
+[pytest]
+# TODO: s/--strict/--strict-markers/ once xenial support is dropped
+addopts = --strict
+markers =
+ allow_subp_for: allow subp usage for the given commands (disable_subp_usage)
+ allow_all_subp: allow all subp usage (disable_subp_usage)
+ ds_sys_cfg: a sys_cfg dict to be used by datasource fixtures