Skip to content

Commit

Permalink
move coveragrc to pyproject.toml
Browse files Browse the repository at this point in the history
  • Loading branch information
graingert committed Nov 5, 2023
1 parent 549f46c commit 645ab9e
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 41 deletions.
36 changes: 0 additions & 36 deletions .coveragerc

This file was deleted.

10 changes: 5 additions & 5 deletions ci.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
c#!/bin/bash

set -ex -o pipefail

Expand Down Expand Up @@ -128,17 +128,17 @@ else

echo "::endgroup::"
echo "::group:: Run Tests"
if COVERAGE_PROCESS_START=$(pwd)/../.coveragerc coverage run --rcfile=../.coveragerc -m pytest -r a -p trio._tests.pytest_plugin --junitxml=../test-results.xml --run-slow ${INSTALLDIR} --verbose --durations=10 $flags; then
if COVERAGE_PROCESS_START=$(pwd)/../pyproject.toml coverage run --rcfile=../pyproject.toml -m pytest -r a -p trio._tests.pytest_plugin --junitxml=../test-results.xml --run-slow ${INSTALLDIR} --verbose --durations=10 $flags; then
PASSED=true
else
PASSED=false
fi
echo "::endgroup::"
echo "::group::Coverage"

coverage combine --rcfile ../.coveragerc
coverage report -m --rcfile ../.coveragerc
coverage xml --rcfile ../.coveragerc
coverage combine --rcfile ../pyproject.toml
coverage report -m --rcfile ../pyproject.toml
coverage xml --rcfile ../pyproject.toml

# Remove the LSP again; again we want to do this ASAP to avoid
# accidentally breaking other stuff.
Expand Down
1 change: 1 addition & 0 deletions newsfragments/2867.misc.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
move .coveragerc into pyproject.toml
39 changes: 39 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -230,3 +230,42 @@ showcontent = true
directory = "misc"
name = "Miscellaneous internal changes"
showcontent = true

[tool.coverage.run]
branch = true
source = ["trio"]
omit = [
# These are run in subprocesses, but still don't work. We follow
# coverage's documentation to no avail.
"*/trio/_core/_tests/test_multierror_scripts/*",
# Omit the generated files in trio/_core starting with _generated_
"*/trio/_core/_generated_*",
# Script used to check type completeness that isn't run in tests
"*/trio/_tests/check_type_completeness.py",
]
# The test suite spawns subprocesses to test some stuff, so make sure
# this doesn't corrupt the coverage files
parallel = true

[tool.coverage.report]
precision = 1
skip_covered = true
exclude_lines = [
"pragma: no cover",
"abc.abstractmethod",
"if TYPE_CHECKING.*:",
"if _t.TYPE_CHECKING:",
"if t.TYPE_CHECKING:",
"@overload",
'class .*\bProtocol\b.*\):',
"raise NotImplementedError",
]
partial_branches = [
"pragma: no branch",
"if not TYPE_CHECKING:",
"if not _t.TYPE_CHECKING:",
"if not t.TYPE_CHECKING:",
"if .* or not TYPE_CHECKING:",
"if .* or not _t.TYPE_CHECKING:",
"if .* or not t.TYPE_CHECKING:",
]

0 comments on commit 645ab9e

Please sign in to comment.