From 60666da3db5aeb4674d651d2b4bddade32adbb82 Mon Sep 17 00:00:00 2001 From: Sorin Sbarnea Date: Wed, 4 Jan 2023 22:37:53 +0000 Subject: [PATCH] Update test dependencies --- .coveragerc | 3 --- .github/workflows/tox.yml | 11 +++++++---- pyproject.toml | 29 ++++++++++++++++----------- requirements.txt | 41 ++++++++++++++++++--------------------- tox.ini | 38 +++++++++++++++++++++++++----------- 5 files changed, 71 insertions(+), 51 deletions(-) delete mode 100644 .coveragerc diff --git a/.coveragerc b/.coveragerc deleted file mode 100644 index 8795569e47..0000000000 --- a/.coveragerc +++ /dev/null @@ -1,3 +0,0 @@ -[run] -omit = - */molecule/cookiecutter/* diff --git a/.github/workflows/tox.yml b/.github/workflows/tox.yml index 645d6aefb3..512c47abff 100644 --- a/.github/workflows/tox.yml +++ b/.github/workflows/tox.yml @@ -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() diff --git a/pyproject.toml b/pyproject.toml index 1f23202cbc..46aeb8d65a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -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] @@ -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 diff --git a/requirements.txt b/requirements.txt index 3bff0b6e2d..8cfb062224 100644 --- a/requirements.txt +++ b/requirements.txt @@ -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 @@ -23,32 +23,31 @@ 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 @@ -56,27 +55,25 @@ 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 @@ -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 diff --git a/tox.ini b/tox.ini index 8434eae90d..38db07bbdc 100644 --- a/tox.ini +++ b/tox.ini @@ -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 = @@ -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=-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 .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 @@ -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]