summaryrefslogtreecommitdiff
path: root/tox.ini
diff options
context:
space:
mode:
authorDaniel Watkins <oddbloke@ubuntu.com>2020-03-10 13:26:05 -0400
committerGitHub <noreply@github.com>2020-03-10 11:26:05 -0600
commit986f37b017134ced5d9dd38b420350916297002b (patch)
tree59fe191bbc8641a14d60f37499412912ba824443 /tox.ini
parent71af48df3514ca831c90b77dc71ba0a121dec401 (diff)
downloadvyos-cloud-init-986f37b017134ced5d9dd38b420350916297002b.tar.gz
vyos-cloud-init-986f37b017134ced5d9dd38b420350916297002b.zip
cloudinit: move to pytest for running tests (#211)
As the nose docs[0] themselves note, it has been in maintenance mode for the past several years. pytest is an actively developed, featureful and popular alternative that the nose docs themselves recommend. See [1] for more details about the thinking here. (This PR also removes stale tox definitions, instead of modifying them.) [0] https://nose.readthedocs.io/en/latest/ [1] https://lists.launchpad.net/cloud-init/msg00245.html
Diffstat (limited to 'tox.ini')
-rw-r--r--tox.ini73
1 files changed, 29 insertions, 44 deletions
diff --git a/tox.ini b/tox.ini
index 8612f034..8c994a05 100644
--- a/tox.ini
+++ b/tox.ini
@@ -1,13 +1,13 @@
[tox]
-envlist = py3, xenial, pycodestyle, pyflakes, pylint
+envlist = py3, xenial-dev, pycodestyle, pyflakes, 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]
basepython = python3
@@ -32,23 +32,16 @@ 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
@@ -62,11 +55,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
@@ -83,38 +80,26 @@ deps =
# test-requirements
httpretty==0.9.6
mock==1.3.0
- nose==1.3.7
unittest2==1.1.0
contextlib2==0.5.1
-[testenv:centos6]
-basepython = python2.6
-commands = nosetests {posargs:tests/unittests cloudinit}
+[testenv:xenial]
+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
+ # Refer to the comment in [xenial-shared-deps] for details
+ {[xenial-shared-deps]deps}
+ pytest==2.8.7
-[testenv:opensusel150]
-basepython = python2.7
-commands = nosetests {posargs:tests/unittests cloudinit}
+[testenv:xenial-dev]
+commands = {[testenv:xenial]commands}
+basepython = {[testenv:xenial]basepython}
deps =
- # requirements
- jinja2==2.10
- PyYAML==3.12
- oauthlib==2.0.6
- configobj==5.0.6
- requests==2.18.4
- jsonpatch==1.16
- six==1.11.0
- -r{toxinidir}/test-requirements.txt
+ # Refer to the comment in [xenial-shared-deps] for details
+ {[xenial-shared-deps]deps}
+ pytest==3.0.7
[testenv:tip-pycodestyle]
commands = {envpython} -m pycodestyle {posargs:cloudinit/ tests/ tools/}