Blame tox.ini

Packit Service a04d08
[tox]
Packit Service 751c4a
envlist = py3, xenial-dev, flake8, pylint
Packit Service a04d08
recreate = True
Packit Service a04d08
Packit Service a04d08
[testenv]
Packit Service 751c4a
commands = {envpython} -m pytest {posargs:tests/unittests cloudinit}
Packit Service a04d08
setenv =
Packit Service a04d08
    LC_ALL = en_US.utf-8
Packit Service 751c4a
passenv=
Packit Service 751c4a
    PYTEST_ADDOPTS
Packit Service a04d08
Packit Service 751c4a
[testenv:flake8]
Packit Service a04d08
basepython = python3
Packit Service a04d08
deps =
Packit Service 751c4a
    flake8==3.8.2
Packit Service 751c4a
commands = {envpython} -m flake8 {posargs:cloudinit/ tests/ tools/}
Packit Service a04d08
Packit Service a04d08
# https://github.com/gabrielfalcao/HTTPretty/issues/223
Packit Service a04d08
setenv =
Packit Service a04d08
    LC_ALL = en_US.utf-8
Packit Service a04d08
Packit Service a04d08
[testenv:pylint]
Packit Service a04d08
basepython = python3
Packit Service a04d08
deps =
Packit Service a04d08
    # requirements
Packit Service 751c4a
    pylint==2.6.0
Packit Service a04d08
    # test-requirements because unit tests are now present in cloudinit tree
Packit Service a04d08
    -r{toxinidir}/test-requirements.txt
Packit Service a04d08
    -r{toxinidir}/integration-requirements.txt
Packit Service a04d08
commands = {envpython} -m pylint {posargs:cloudinit tests tools}
Packit Service a04d08
Packit Service a04d08
[testenv:py3]
Packit Service a04d08
basepython = python3
Packit Service a04d08
deps =
Packit Service a04d08
    -r{toxinidir}/test-requirements.txt
Packit Service 751c4a
commands = {envpython} -m pytest \
Packit Service 751c4a
            --durations 10 \
Packit Service 751c4a
            {posargs:--cov=cloudinit --cov-branch \
Packit Service a04d08
            tests/unittests cloudinit}
Packit Service a04d08
Packit Service a04d08
[testenv:py27]
Packit Service a04d08
basepython = python2.7
Packit Service a04d08
deps = -r{toxinidir}/test-requirements.txt
Packit Service a04d08
Packit Service a04d08
[flake8]
Packit Service 751c4a
# E226: missing whitespace around arithmetic operator
Packit Service 751c4a
# W503: line break before binary operator
Packit Service 751c4a
# W504: line break after binary operator
Packit Service 751c4a
ignore=E226,W503,W504
Packit Service a04d08
exclude = .venv,.tox,dist,doc,*egg,.git,build,tools
Packit Service 751c4a
per-file-ignores =
Packit Service 751c4a
    cloudinit/cmd/main.py:E402
Packit Service a04d08
Packit Service a04d08
[testenv:doc]
Packit Service a04d08
basepython = python3
Packit Service a04d08
deps =
Packit Service a04d08
    -r{toxinidir}/doc-requirements.txt
Packit Service a04d08
commands =
Packit Service a04d08
    {envpython} -m sphinx {posargs:doc/rtd doc/rtd_html}
Packit Service a04d08
    doc8 doc/rtd
Packit Service a04d08
Packit Service 751c4a
[xenial-shared-deps]
Packit Service 751c4a
# The version of pytest in xenial doesn't work with Python 3.8, so we define
Packit Service 751c4a
# two xenial environments: [testenv:xenial] runs the tests with exactly the
Packit Service 751c4a
# version of pytest present in xenial, and is used in CI.  [testenv:xenial-dev]
Packit Service 751c4a
# runs the tests with the lowest version of pytest that works with Python 3.8,
Packit Service 751c4a
# 3.0.7, but keeps the other dependencies at xenial's level.
Packit Service 751c4a
#
Packit Service 751c4a
# (This section is not a testenv, it is used to maintain a single definition of
Packit Service 751c4a
# the dependencies shared between the two xenial testenvs.)
Packit Service a04d08
deps =
Packit Service a04d08
    # requirements
Packit Service a04d08
    jinja2==2.8
Packit Service a04d08
    pyyaml==3.11
Packit Service a04d08
    oauthlib==1.0.3
Packit Service a04d08
    pyserial==3.0.1
Packit Service a04d08
    configobj==5.0.6
Packit Service a04d08
    requests==2.9.1
Packit Service a04d08
    # test-requirements
Packit Service 751c4a
    pytest-catchlog==1.2.1
Packit Service a04d08
Packit Service 751c4a
[testenv:xenial]
Packit Service 751c4a
# When updating this commands definition, also update the definition in
Packit Service 751c4a
# [testenv:xenial-dev].  See the comment there for details.
Packit Service 751c4a
commands =
Packit Service 751c4a
  python ./tools/pipremove jsonschema
Packit Service 751c4a
  python -m pytest {posargs:tests/unittests cloudinit}
Packit Service 751c4a
basepython = python3
Packit Service a04d08
deps =
Packit Service 751c4a
    # Refer to the comment in [xenial-shared-deps] for details
Packit Service 751c4a
    {[xenial-shared-deps]deps}
Packit Service 751c4a
    httpretty==0.8.6
Packit Service 751c4a
    jsonpatch==1.10
Packit Service 751c4a
    pytest==2.8.7
Packit Service 751c4a
Packit Service 751c4a
[testenv:xenial-dev]
Packit Service 751c4a
# This should be:
Packit Service 751c4a
#   commands = {[testenv:xenial]commands}
Packit Service 751c4a
# but the version of pytest in xenial has a bug
Packit Service 751c4a
# (https://github.com/tox-dev/tox/issues/208) which means that the {posargs}
Packit Service 751c4a
# substitution variable is misparsed and causes a traceback.  Ensure that any
Packit Service 751c4a
# changes here are reflected in [testenv:xenial].
Packit Service 751c4a
commands =
Packit Service 751c4a
  python ./tools/pipremove jsonschema
Packit Service 751c4a
  python -m pytest {posargs:tests/unittests cloudinit}
Packit Service 751c4a
basepython = {[testenv:xenial]basepython}
Packit Service a04d08
deps =
Packit Service 751c4a
    # Refer to the comment in [xenial-shared-deps] for details
Packit Service 751c4a
    {[xenial-shared-deps]deps}
Packit Service 751c4a
    # httpretty in xenial is 0.8.6, not 0.9.5.  The oldest version to work with
Packit Service 751c4a
    # Python 3.7+ is 0.9.5, because it is the first to include this commit:
Packit Service 751c4a
    # https://github.com/gabrielfalcao/HTTPretty/commit/5776d97da3992b9071db5e21faf175f6e8729060
Packit Service 751c4a
    httpretty==0.9.5
Packit Service 751c4a
    # jsonpatch in xenial is 1.10, not 1.19 (#839779). The oldest version
Packit Service 751c4a
    # to work with python3.6 is 1.16 as found in Artful.  To keep default
Packit Service 751c4a
    # invocation of 'tox' happy, accept the difference in version here.
Packit Service a04d08
    jsonpatch==1.16
Packit Service 751c4a
    pytest==3.0.7
Packit Service a04d08
Packit Service 751c4a
[testenv:tip-flake8]
Packit Service 751c4a
commands = {envpython} -m flake8 {posargs:cloudinit/ tests/ tools/}
Packit Service 751c4a
deps = flake8
Packit Service a04d08
Packit Service a04d08
[testenv:tip-pylint]
Packit Service a04d08
commands = {envpython} -m pylint {posargs:cloudinit tests tools}
Packit Service a04d08
deps =
Packit Service a04d08
    # requirements
Packit Service a04d08
    pylint
Packit Service a04d08
    # test-requirements
Packit Service a04d08
    -r{toxinidir}/test-requirements.txt
Packit Service a04d08
    -r{toxinidir}/integration-requirements.txt
Packit Service a04d08
Packit Service a04d08
[testenv:citest]
Packit Service a04d08
basepython = python3
Packit Service a04d08
commands = {envpython} -m tests.cloud_tests {posargs}
Packit Service 751c4a
passenv = HOME TRAVIS
Packit Service a04d08
deps =
Packit Service a04d08
    -r{toxinidir}/integration-requirements.txt
Packit Service 751c4a
Packit Service 751c4a
[pytest]
Packit Service 751c4a
# TODO: s/--strict/--strict-markers/ once xenial support is dropped
Packit Service 751c4a
addopts = --strict
Packit Service 751c4a
markers =
Packit Service 751c4a
    allow_subp_for: allow subp usage for the given commands (disable_subp_usage)
Packit Service 751c4a
    allow_all_subp: allow all subp usage (disable_subp_usage)
Packit Service 751c4a
    ds_sys_cfg: a sys_cfg dict to be used by datasource fixtures