Skip to content

Commit

Permalink
fixup! chore(tox.ini): Simplify configuration, fix minor bugs (canoni…
Browse files Browse the repository at this point in the history
  • Loading branch information
holmanb committed Aug 13, 2024
1 parent 21858f3 commit 4a9e3ef
Showing 1 changed file with 31 additions and 29 deletions.
60 changes: 31 additions & 29 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,11 @@ passenv =
deps =
-r{toxinidir}/requirements.txt
-r{toxinidir}/test-requirements.txt
pytest==8.3.2

[pinned_versions]
[types]
deps =
# each release of type stubs relates to a specific version of a library
# so leave these unpinned
ruff==0.5.7
types-jsonschema
types-Jinja2
types-oauthlib
Expand All @@ -36,18 +35,28 @@ deps =
types-setuptools
typing-extensions

[pinned_versions]
deps =
{[types]deps}
black==24.8.0
hypothesis==6.111.0
hypothesis_jsonschema==0.23.1
isort==5.13.2
mypy==1.11.1
pylint==3.2.6
ruff==0.5.7

[latest_versions]
deps =
{[types]deps}
black
hypothesis
hypothesis_jsonschema
isort
mypy
pylint
pytest
ruff


[files]
schema = cloudinit/config/schemas/schema-cloud-config-v1.json
version = cloudinit/config/schemas/versions.schema.cloud-config.json
Expand Down Expand Up @@ -92,7 +101,6 @@ commands =
{envpython} -m isort --check-only --diff {posargs:.}
{envpython} -m mypy {posargs:cloudinit/ tests/ tools/}


[testenv:do_format]
deps = {[pinned_versions]deps}
commands =
Expand All @@ -104,10 +112,7 @@ commands =
{envpython} -m json.tool --indent 2 {[files]network_v2} {[files]network_v2}

[testenv:do_format_tip]
deps =
{[pinned_versions]deps}
black
isort
deps = {[latest_versions]deps}
commands =
{envpython} -m isort .
{envpython} -m black .
Expand All @@ -119,16 +124,10 @@ commands =
[testenv:py3]
commands = {envpython} -m pytest -m "not hypothesis_slow" --cov=cloud-init --cov-branch {posargs:tests/unittests}

[testenv:python37]
deps =
-r requirements.txt
-r test-requirements.txt
pytest==7.4.4
commands = {envpython} -m pytest -m "not hypothesis_slow" --cov=cloud-init --cov-branch {posargs:tests/unittests}

# experimental
[testenv:py3-fast]
deps = pytest-xdist
deps =
{[pinned_versions]deps}
pytest-xdist
commands = {envpython} -m pytest -n auto -m "not hypothesis_slow" -m "not serial" {posargs:tests/unittests}

[testenv:hypothesis-slow]
Expand Down Expand Up @@ -172,15 +171,14 @@ deps =
commands = {envpython} -m pytest -m "not hypothesis_slow" --cov=cloud-init --cov-branch {posargs:tests/unittests}

[testenv:doc]
deps = {[pinned_versions]deps}
deps = -r{toxinidir}/doc-requirements.txt
commands =
{envpython} -m sphinx {posargs:-W doc/rtd doc/rtd_html}
doc8 doc/rtd
{envpython} -m doc8 doc/rtd

[testenv:doc-spelling]
deps = {[pinned_versions]deps}
commands =
{envpython} -m sphinx -b spelling {posargs:-W doc/rtd doc/rtd_html}
deps = -r{toxinidir}/doc-requirements.txt
commands = {envpython} -m sphinx -b spelling {posargs:-W doc/rtd doc/rtd_html}

# linkcheck shows false positives and has noisy output.
# Despite these limitations, it is better than a manual search of the docs.
Expand All @@ -200,15 +198,13 @@ commands = {envpython} -m ruff check {posargs:.}

[testenv:tip-mypy]
deps =
{[pinned_versions]deps}
{[latest_versions]deps}
commands = {envpython} -m mypy {posargs:cloudinit/ tests/ tools/}

[testenv:tip-pylint]
deps = {[latest_versions]deps}
commands = {envpython} -m pylint {posargs:.}


[testenv:tip-black]
deps = {[latest_versions]deps}
commands = {envpython} -m black --check {posargs:.}
Expand All @@ -218,7 +214,9 @@ deps = {[latest_versions]deps}
commands = {envpython} -m isort --check-only --diff {posargs:.}

[testenv:integration-tests]
deps = {[pinned_versions]deps}
deps =
{[pinned_versions]deps}
-r{toxinidir}/integration-requirements.txt
commands = {envpython} -m pytest --log-cli-level=INFO {posargs:tests/integration_tests}
passenv =
CLOUD_INIT_*
Expand All @@ -227,7 +225,9 @@ passenv =
OS_*

[testenv:integration-tests-ci]
deps = {[pinned_versions]deps}
deps =
{[pinned_versions]deps}
-r{toxinidir}/integration-requirements.txt
commands = {envpython} -m pytest --log-cli-level=INFO {posargs:tests/integration_tests}
passenv =
CLOUD_INIT_*
Expand All @@ -239,7 +239,9 @@ setenv =
[testenv:integration-tests-jenkins]
# Pytest's RC=1 means "Tests were collected and run but some of the tests failed".
# Do not fail in this case, but let Jenkins handle it using the junit report.
deps = {[pinned_versions]deps}
deps =
{[pinned_versions]deps}
-r{toxinidir}/integration-requirements.txt
allowlist_externals = sh
commands = sh -c "{envpython} -m pytest --log-cli-level=INFO {posargs:tests/integration_tests/none} || [ $? -eq 1 ]"
passenv =
Expand Down

0 comments on commit 4a9e3ef

Please sign in to comment.