Skip to content

Commit

Permalink
Merge pull request #1 from ferdnyc/pytest
Browse files Browse the repository at this point in the history
test coverage
  • Loading branch information
ferdnyc authored Aug 9, 2024
2 parents 24ff13d + b0b30b4 commit 62d2331
Show file tree
Hide file tree
Showing 4 changed files with 57 additions and 3 deletions.
16 changes: 16 additions & 0 deletions .coveragerc
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# SPDX-FileCopyrightText: 2024 pydot contributors
#
# SPDX-License-Identifier: MIT

[paths]
source =
src
*/site-packages

[run]
branch = true
parallel = true
source =
pydot
test

31 changes: 30 additions & 1 deletion .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ jobs:
with:
python-version: "${{ matrix.python-version }}"
cache: "pip"
- name: "Set up TEST_ERROR_DIR"
- name: "Set up environment"
shell: bash
run: |
mkdir test_errors
Expand All @@ -62,6 +62,7 @@ jobs:
else
echo "TEST_ERROR_DIR=$(pwd -P)/test_errors" >> "$GITHUB_ENV"
fi
echo "COVERAGE_FILE=.coverage.${{ runner.os }}.${{ matrix.python-version }}" >> "$GITHUB_ENV"
- name: "Install graphviz (Linux)"
if: runner.os == 'linux'
run: sudo apt install graphviz
Expand All @@ -87,3 +88,31 @@ jobs:
name: test-errors-${{ runner.os }}-${{ matrix.python-version }}
path: ${{ env.TEST_ERROR_DIR }}
if-no-files-found: ignore
- name: "Publish coverage-data artifact"
if: ${{ always() }}
uses: actions/upload-artifact@0b2256b8c012f0828dc542b3febcab082c67f72b # v4.3.4
with:
name: coverage-data-${{ runner.os }}-${{ matrix.python-version }}
path: .coverage.*
if-no-files-found: ignore

coverage:
runs-on: ubuntu-latest
needs: tests
steps:
- name: "Check out source"
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
with:
fetch-depth: 0
- name: "Install coverage.py"
run: python -m pip install coverage
- name: "Download coverage-data artifacts"
uses: actions/download-artifact@v4
with:
pattern: coverage-data-*
merge-multiple: true
- name: "Combine coverage data"
run: coverage combine
- name: "Report aggregate coverage"
run: coverage report

4 changes: 3 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,9 @@ tests = [
'parameterized',
'ruff',
'tox',
'unittest-parallel',
'pytest',
'pytest-cov',
'pytest-xdist[psutil]',
]
release = ['zest.releaser[recommended]']

Expand Down
9 changes: 8 additions & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ push-changes=no
create-wheel=yes
tag-format=v{version}

[tool:pytest]
testpaths = test

[tox:tox]
min_version = 4.6.3
env_list =
Expand All @@ -25,9 +28,13 @@ package = wheel
wheel_build_env = .pkg
pass_env =
TEST_ERROR_DIR
commands = unittest-parallel --level test -vv
setenv =
DEFAULT_COVERAGE_FILE = .coverage.{envname}
COVERAGE_FILE = {env:COVERAGE_FILE:{env:DEFAULT_COVERAGE_FILE}}
commands = pytest -n auto --cov

[testenv:ruff]
skip_install = true
deps = ruff==0.4.8
commands =
ruff format --diff .
Expand Down

0 comments on commit 62d2331

Please sign in to comment.