Skip to content

Commit

Permalink
[REF] CI: Enable tox with parallels + codecov compatibility
Browse files Browse the repository at this point in the history
* Add tox pytest posargs after in order to be able to add '-k' parameter to run only one particular test
  • Loading branch information
moylop260 committed Oct 24, 2022
1 parent d805921 commit 817e790
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 14 deletions.
22 changes: 11 additions & 11 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,19 +24,19 @@ jobs:
python: '3.7'
toxpython: 'python3.7'
python_arch: 'x64'
tox_env: 'py37,codecov'
tox_env: 'py37,report,codecov'
os: 'ubuntu-latest'
- name: 'py38-cover (ubuntu)'
python: '3.8'
toxpython: 'python3.8'
python_arch: 'x64'
tox_env: 'py38,codecov'
tox_env: 'py38,report,codecov'
os: 'ubuntu-latest'
- name: 'py39-cover (ubuntu)'
python: '3.9'
toxpython: 'python3.9'
python_arch: 'x64'
tox_env: 'py39,codecov'
tox_env: 'py39,report,codecov'
os: 'ubuntu-latest'
- name: 'py310-cover (ubuntu) + lint + build'
python: '3.10'
Expand All @@ -51,51 +51,51 @@ jobs:
# python: '3.7'
# toxpython: 'python3.7'
# python_arch: 'x64'
# tox_env: 'py37,codecov'
# tox_env: 'py37,report,codecov'
# os: 'windows-latest'
- name: 'py38-cover (windows)'
python: '3.8'
toxpython: 'python3.8'
python_arch: 'x64'
tox_env: 'py38,codecov'
tox_env: 'py38,report,codecov'
os: 'windows-latest'
- name: 'py39-cover (windows)'
python: '3.9'
toxpython: 'python3.9'
python_arch: 'x64'
tox_env: 'py39,codecov'
tox_env: 'py39,report,codecov'
os: 'windows-latest'
- name: 'py310-cover (windows)'
python: '3.10'
toxpython: 'python3.10'
python_arch: 'x64'
tox_env: 'py310,codecov'
tox_env: 'py310,report,codecov'
os: 'windows-latest'

# macos
- name: 'py37-cover (macos)'
python: '3.7'
toxpython: 'python3.7'
python_arch: 'x64'
tox_env: 'py37,codecov'
tox_env: 'py37,report,codecov'
os: 'macos-latest'
- name: 'py38-cover (macos)'
python: '3.8'
toxpython: 'python3.8'
python_arch: 'x64'
tox_env: 'py38,codecov'
tox_env: 'py38,report,codecov'
os: 'macos-latest'
- name: 'py39-cover (macos)'
python: '3.9'
toxpython: 'python3.9'
python_arch: 'x64'
tox_env: 'py39,codecov'
tox_env: 'py39,report,codecov'
os: 'macos-latest'
- name: 'py310-cover (macos)'
python: '3.10'
toxpython: 'python3.10'
python_arch: 'x64'
tox_env: 'py310,codecov'
tox_env: 'py310,report,codecov'
os: 'macos-latest'

steps:
Expand Down
8 changes: 5 additions & 3 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@ setenv =
PYTHONPATH={toxinidir}/tests
PYTHONUNBUFFERED=yes
# Compatible with "tox --parallel" to avoid concurrency
# COVERAGE_FILE={toxinidir}/.coverage_{envname}
COVERAGE_FILE={toxinidir}/.coverage.{envname}
COVERAGE_CONTEXT={envname}
passenv =
*
deps = -r{toxinidir}/test-requirements.txt
usedevelop = true
commands =
{posargs:pytest -s --cov --cov-report=term-missing -vv}
pytest {posargs:}

[testenv:update-readme]
basepython = {env:TOXPYTHON:python3.10}
Expand Down Expand Up @@ -60,9 +60,11 @@ commands =
[testenv:report]
deps = coverage
skip_install = true
setenv =
COVERAGE_FILE = {toxinidir}/.coverage
commands =
# Workaround https://github.com/tox-dev/tox/issues/1571
python -c 'from glob import glob; import subprocess; [subprocess.check_call(["coverage", "combine", "--keep", i]) for i in glob(".coverage_*")]'
python -c 'from glob import glob; import subprocess; [subprocess.check_call(["coverage", "combine", "--keep", i]) for i in glob(".coverage.*")]'
coverage report
coverage html

Expand Down

0 comments on commit 817e790

Please sign in to comment.