Skip to content

Commit

Permalink
Update test dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
ssbarnea committed Jan 5, 2023
1 parent 4dd1294 commit 1bb769d
Show file tree
Hide file tree
Showing 5 changed files with 71 additions and 51 deletions.
3 changes: 0 additions & 3 deletions .coveragerc

This file was deleted.

11 changes: 7 additions & 4 deletions .github/workflows/tox.yml
Original file line number Diff line number Diff line change
Expand Up @@ -88,18 +88,21 @@ jobs:
run: |
${{ matrix.PREFIX }} tox -e ${{ matrix.tox_env }}
continue-on-error: ${{ matrix.experimental || false }}

- name: Combine coverage data
if: ${{ startsWith(matrix.tox_env, 'py') }}
# produce a single .coverage file at repo root
run: coverage combine .tox/.coverage.*
if: ${{ matrix.cover == true }}
run: tox -e coverage

- name: Upload coverage data
if: ${{ matrix.cover == true }}
if: ${{ startsWith(matrix.tox_env, 'py') }}
uses: codecov/codecov-action@v3
with:
name: ${{ matrix.tox_env }}
fail_ci_if_error: true # optional (default = false)
fail_ci_if_error: false # see https://github.com/codecov/codecov-action/issues/598
token: ${{ secrets.CODECOV_TOKEN }}
verbose: true # optional (default = false)

check:
if: always()

Expand Down
29 changes: 18 additions & 11 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -76,17 +76,16 @@ test = [
# Do not include ansible or any package that would drag ansible in here
# We want to assure test extra provides tools to test molecule and its
# related tools/plugins but w/o ansible, which can be installed separated.
"ansi2html >= 1.6.0",
"coverage >= 6.2",
"filelock",
"ansi2html >= 1.8.0",
"coverage >= 7.0.3",
"filelock >= 3.9.0",
"pexpect >= 4.8.0, < 5",
"pytest-cov >= 2.10.1",
"pytest-html >= 3.0.0",
"pytest-mock >= 3.3.1",
"pytest-plus >= 0.2",
"pytest-testinfra >= 6.1.0",
"pytest-xdist >= 2.1.0",
"pytest >= 6.1.2",
"pytest-html >= 3.2.0",
"pytest-mock >= 3.10.0",
"pytest-plus >= 0.4.0",
"pytest-testinfra >= 7.0.0",
"pytest-xdist >= 3.1.0",
"pytest >= 7.2.0",
]

[project.scripts]
Expand All @@ -101,10 +100,18 @@ ansible = "molecule.verifier.ansible:Ansible"

[tool.coverage.run]
source = ["src"]
branch = true
# branch = true
parallel = true
concurrency = ["multiprocessing", "thread"]
data_file = ".tox/.coverage"
relative_files = true

[tool.coverage.report]
exclude_lines = ["pragma: no cover", "if TYPE_CHECKING:"]
omit = ["test/*"]
fail_under = 88
skip_covered = true
# skip_empty = true

[tool.doc8]
# see https://github.com/PyCQA/doc8/issues/75
Expand Down
41 changes: 19 additions & 22 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
#
alabaster==0.7.12
ansi2html==1.8.0
ansible-compat==2.2.6
ansible-core==2.14.0
ansible-compat==2.2.7
ansible-core==2.14.1
ansible-pygments==0.1.1
arrow==1.2.3
attrs==22.1.0
attrs==22.2.0
babel==2.11.0
binaryornot==0.4.4
certifi==2022.12.7
Expand All @@ -23,60 +23,57 @@ click==8.1.3
click-help-colors==0.9.1
commonmark==0.9.1
cookiecutter==2.1.1
coverage==6.5.0
cryptography==38.0.4
coverage==7.0.3
cryptography==39.0.0
distlib==0.3.6
distro==1.8.0
docutils==0.17.1
enrich==1.2.7
exceptiongroup==1.0.4
exceptiongroup==1.1.0
execnet==1.9.0
filelock==3.8.2
filelock==3.9.0
flake8==6.0.0
identify==2.5.9
identify==2.5.12
idna==3.4
imagesize==1.4.1
importlib-metadata==5.1.0
importlib-metadata==6.0.0
iniconfig==1.1.1
jinja2==3.1.2
jinja2-time==0.2.0
jsonschema==4.17.3
markupsafe==2.1.1
mccabe==0.7.0
more-itertools==9.0.0
nodeenv==1.7.0
packaging==21.3
pathspec==0.10.2
packaging==22.0
pathspec==0.10.3
pexpect==4.8.0
platformdirs==2.5.4
platformdirs==2.6.2
pluggy==1.0.0
pre-commit==2.21.0
ptyprocess==0.7.0
py==1.11.0
pycodestyle==2.10.0
pycparser==2.21
pyflakes==3.0.1
pygments==2.13.0
pyparsing==3.0.9
pyrsistent==0.19.2
pygments==2.14.0
pyrsistent==0.19.3
pytest==7.2.0
pytest-cov==4.0.0
pytest-html==3.2.0
pytest-metadata==2.0.4
pytest-mock==3.10.0
pytest-plus==0.2
pytest-plus==0.4.0
pytest-testinfra==7.0.0
pytest-xdist==3.1.0
python-dateutil==2.8.2
python-slugify==7.0.0
pytz==2022.6
pytz==2022.7
pyyaml==6.0
requests==2.28.1
resolvelib==0.8.1
rich==12.6.0
rich==13.0.0
ruamel-yaml==0.17.21
ruamel-yaml-clib==0.2.7
simplejson==3.18.0
simplejson==3.18.1
six==1.16.0
snowballstemmer==2.2.0
sphinx==5.3.0
Expand All @@ -93,7 +90,7 @@ subprocess-tee==0.4.1
text-unidecode==1.3
tomli==2.0.1
urllib3==1.26.13
virtualenv==20.17.0
virtualenv==20.17.1
yamllint==1.28.0
zipp==3.11.0

Expand Down
38 changes: 27 additions & 11 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ isolated_build = True
[testenv]
# both options needed to workaround https://github.com/tox-dev/tox/issues/2197
usedevelop = true
skip_install = True
skip_install = false

# do not put * in passenv as it may break builds do to reduced isolation
passenv =
Expand All @@ -37,33 +37,38 @@ setenv =
ANSIBLE_DISPLAY_FAILED_STDERR=1
ANSIBLE_NOCOWS=1
ANSIBLE_VERBOSITY=1
COVERAGE_FILE = {env:COVERAGE_FILE:{toxworkdir}/.coverage.{envname}}
COVERAGE_FILE={env:COVERAGE_FILE:{toxworkdir}/.coverage.{envname}}
COVERAGE_PROCESS_START={toxinidir}/pyproject.toml
MOLECULE_NO_LOG=0
PIP_CONSTRAINT = {toxinidir}/requirements.txt
devel: PIP_CONSTRAINT=/dev/null
PIP_DISABLE_PIP_VERSION_CHECK=1
PYTHONDONTWRITEBYTECODE=1
PYTHONUNBUFFERED=1
_EXTRAS=-l -n auto --cov=molecule --no-cov-on-fail --html={envlogdir}/reports.html --self-contained-html
# -n auto
_EXTRAS=-n2 -l --html={envlogdir}/reports.html --self-contained-html
deps =
py{39,310,311,312}: --editable .[docker,lint,podman,test,windows]
# py,py{39,310,311,312}: --editable .[docker,lint,podman,test,windows]
devel: git+https://github.com/ansible/ansible#egg=ansible-core
# pytest-molecule not used but we want to check that it does not conflict
devel: git+https://github.com/ansible-community/pytest-molecule#egg=pytest-molecule
dockerfile: ansible>=2.10
py: ansible-core
; commands_pre =
; find {toxinidir} -type f -not -path '{toxinidir}/.tox/*' -path '*/__pycache__/*' -name '*.py[c|o]' -delete
; sh -c 'find {homedir}/.cache -type d -path "*/molecule_*" -exec rm -rfv \{\} +;'
dockerfile: ansible-core>=2.12
extras =
docker
lint
podman
test
windows
commands =
ansibledevel: ansible-galaxy install git+https://github.com/ansible-collections/community.general.git
dockerfile: ansible-galaxy install community.docker
# failsafe as pip may install incompatible dependencies
pip check
# failsafe for preventing changes that may break pytest collection
sh -c "PYTEST_ADDOPTS= python -m pytest -p no:cov --collect-only"
sh -c "PYTEST_ADDOPTS= python -m pytest -p no:cov --collect-only >>/dev/null"
sh -c "rm -f .tox/.coverage.*"
# html report is used by Zuul CI to display reports
python -m pytest {env:_EXTRAS} {env:PYTEST_ADDOPTS:} {posargs}
coverage run -m pytest {env:_EXTRAS} {env:PYTEST_ADDOPTS:} {posargs}

allowlist_externals =
find
Expand Down Expand Up @@ -200,3 +205,14 @@ commands =
bash ./tools/smoketest.sh
allowlist_externals =
bash

[testenv:coverage]
description = Combines and displays coverage results
commands =
-sh -c "coverage combine --append .tox/.coverage.*"
# needed by codecov github actions:
coverage xml -i
# just for humans running it:
coverage report -i
deps =
coverage[toml]

0 comments on commit 1bb769d

Please sign in to comment.