Skip to content

Commit

Permalink
Upgrade tox config (#193)
Browse files Browse the repository at this point in the history
  • Loading branch information
ssbarnea authored Nov 30, 2022
1 parent 32980e1 commit 7551f2b
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 16 deletions.
12 changes: 4 additions & 8 deletions .github/workflows/tox.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
env:
- TOXENV: lint
- TOXENV: docs
- TOXENV: packaging
- TOXENV: pkg
env:
TOX_PARALLEL_NO_SPINNER: 1
FORCE_COLOR: 1
Expand Down Expand Up @@ -58,7 +58,7 @@ jobs:
key: ${{ matrix.name }}-pip-${{ hashFiles('setup.cfg', 'tox.ini', 'pyproject.toml', '.pre-commit-config.yaml') }}

- name: Install tox
run: python3 -m pip install --upgrade tox
run: python3 -m pip install --upgrade 'tox>=4.0.0rc1'

- name: Log installed dists
run: python -m pip freeze --all
Expand Down Expand Up @@ -119,7 +119,7 @@ jobs:
python-version: "3.10"
- name: py311
tox_env: py311,py311-devel
python-version: "~3.11.0-0" # see https://github.com/actions/setup-python/issues/213#issuecomment-1146676713
python-version: "3.11"
# macos
- name: py38@macos
tox_env: py38,py38-ansible29 # 2.14(devel) does not support 3.8
Expand Down Expand Up @@ -162,7 +162,7 @@ jobs:
key: ${{ runner.os }}-${{ matrix.name }}-pip-${{ hashFiles('constraints.txt', 'setup.cfg', 'tox.ini', 'pyproject.toml', '.pre-commit-config.yaml', 'pytest.ini') }}

- name: Install tox
run: python3 -m pip install --upgrade tox 'coverage[toml]'
run: python3 -m pip install --upgrade "tox>=4.0.0rc1"

- name: Log installed dists
run: python3 -m pip freeze --all
Expand All @@ -173,10 +173,6 @@ jobs:
- name: "Test with tox: ${{ matrix.tox_env }}"
run: python3 -m tox -e ${{ matrix.tox_env }}

- name: Combine coverage data
# produce a single .coverage file at repo root
run: coverage combine .tox/.coverage.*

- name: Upload coverage data
if: "runner.os == 'Linux'"
uses: codecov/codecov-action@v3
Expand Down
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ branch = true

[tool.coverage.report]
exclude_lines = ["pragma: no cover", "if TYPE_CHECKING:"]
skip_covered = true

[tool.isort]
profile = "black"
Expand Down
14 changes: 6 additions & 8 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,18 +1,15 @@
[tox]
minversion = 3.16.1
minversion = 4.0.0rc1
envlist =
lint
packaging
pkg
docs
# matrix assumed current (implicit) is 2.13:
py38{,-ansible29}
py39{,-devel}
py310{,-devel}
py311{,-devel}
isolated_build = true
requires =
setuptools >= 41.4.0
pip >= 19.3.0
skip_missing_interpreters = True
skipsdist = true

Expand Down Expand Up @@ -41,10 +38,11 @@ deps =
--editable .[test]

commands =
ansible --version
sh -c "ansible --version | head -n 1"
# We add coverage options but not making them mandatory as we do not want to force
# pytest users to run coverage when they just want to run a single test with `pytest -k test`
coverage run -m pytest {posargs:}
sh -c "coverage xml || true && coverage report"
commands_pre =
# safety measure to assure we do not accidentally run tests with broken dependencies
{envpython} -m pip check
Expand Down Expand Up @@ -99,8 +97,7 @@ skip_install = true
commands =
{[testenv:lint]commands} --hook-stage manual

[testenv:packaging]
basepython = python3
[testenv:pkg]
description =
Build package, verify metadata, install package and assert behavior when ansible is missing.
deps =
Expand All @@ -122,6 +119,7 @@ commands =
twine check --strict {toxinidir}/dist/*
# Install the wheel
sh -c "python3 -m pip install {toxinidir}/dist/*.whl"
pip uninstall -y ansible-compat

[testenv:py{39,38,37,36}]
description = Run the tests with {basepython} ansible-core 2.11+
Expand Down

0 comments on commit 7551f2b

Please sign in to comment.