Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .github/workflows/test_tox.yml
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,14 @@ jobs:
a/
cache-key: cache-${{ github.run_id }}

test_coverage_github:
uses: ./.github/workflows/tox.yml
with:
coverage: github
envs: |
- linux: py313-covcheck
- linux: py314-covcheck

test_artifact_upload:
uses: ./.github/workflows/tox.yml
with:
Expand Down
50 changes: 47 additions & 3 deletions .github/workflows/tox.yml

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/source/tox.rst
Original file line number Diff line number Diff line change
Expand Up @@ -164,8 +164,8 @@ This option has no effect if ``pytest`` is ``false``.
coverage
^^^^^^^^

A space separated list of coverage providers to upload to. Currently
only ``codecov`` is supported. Default is to not upload coverage
A space separated list of coverage providers to upload to, either
``codecov`` or ``github``. Default is to not upload coverage
reports.

See also, ``CODECOV_TOKEN`` secret.
Expand Down
5 changes: 5 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,11 @@ concurrency = [
"pytest-repeat>=0.9.3",
"pytest-run-parallel>=0.4.4",
]
covcheck = [
"coverage[toml] ; python_version < '3.11'",
"coverage>=7.11.3",
"pytest-cov>=7.0.0",
]
test = [
"hypothesis>=6.113.0",
"pytest>=8.3.5",
Expand Down
13 changes: 8 additions & 5 deletions tools/tox_matrix.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,11 +152,14 @@ def get_matrix_item(env, global_libraries, global_string_parameters,
# set pytest_flag
item["pytest_flag"] = ""
sep = r"\\" if platform == "windows" else "/"
if item["pytest"] == "true" and "codecov" in item.get("coverage", ""):
item["pytest_flag"] += (
rf"--cov-report=xml:${{GITHUB_WORKSPACE}}{sep}coverage.xml ")
if item["pytest"] == "true" and item["pytest-results-summary"] == "true":
item["pytest_flag"] += rf"--junitxml ${{GITHUB_WORKSPACE}}{sep}results.xml "
if item["pytest"] == "true":
if "codecov" in item.get("coverage", ""):
item["pytest_flag"] += (
rf"--cov --cov-report=xml:${{GITHUB_WORKSPACE}}{sep}coverage.xml "
)

if item["pytest-results-summary"] == "true":
item["pytest_flag"] += rf"--junitxml ${{GITHUB_WORKSPACE}}{sep}results.xml "

# set libraries
env_libraries = env.get("libraries")
Expand Down
5 changes: 5 additions & 0 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ envlist =
py{,py}3{10,13}-python_version
libraries
cache-{setup,verify}
covcheck

[testenv]
allowlist_externals =
Expand All @@ -17,6 +18,9 @@ allowlist_externals =
bash
rolldice
which
dependency_groups =
covcheck: covcheck
covcheck: test
skip_install = true
passenv = MY_VAR
commands =
Expand Down Expand Up @@ -48,6 +52,7 @@ commands =
artifact-upload: bash -c "echo 'hello world' > test.txt"
# Verify that freethreaded builds are using freethreaded interpreter
py313t: python -c "import sys; assert 'free-threading' in sys.version"
covcheck: coverage run --parallel-mode -m pytest --pyargs test_package {posargs}

[testenv:pep8]
description = verify pep8
Expand Down