Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Coverage cleanups #1674

Merged
merged 9 commits into from
Nov 14, 2022
20 changes: 4 additions & 16 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ jobs:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install tox coverage[toml]
python -m pip install tox coverage[toml]~=6.6.0b1
- name: Get packages
uses: actions/download-artifact@v3
with:
Expand Down Expand Up @@ -123,17 +123,11 @@ jobs:
python-version: ${{ env.max_python_version }}
- name: Install dependencies
run: |
python -m pip install coverage[toml]
python -m pip install coverage[toml]~=6.6.0b1
- name: Retrieve coverage data
uses: actions/download-artifact@v3
with:
name: core-coverage-data
- name: Normalize paths in coverage data
run: |
# See https://github.com/nedbat/coveragepy/issues/991
for coverage in `ls .coverage.*`; do
sqlite3 $coverage "update file set path = replace(path, '\\', '/')"
done
- name: Combine coverage
run: |
python -m coverage combine
Expand Down Expand Up @@ -186,7 +180,7 @@ jobs:
- name: Install dependencies
run: |
${{ matrix.pre-command }}
python -m pip install tox coverage[toml]
python -m pip install tox coverage[toml]~=6.6.0b1
- name: Test
env:
TOGA_INSTALL_COMMAND: 'bash -c "pip install ../{core,dummy,${{ matrix.backend }}}/dist/*.whl"'
Expand Down Expand Up @@ -220,17 +214,11 @@ jobs:
python-version: ${{ env.max_python_version }}
- name: Install dependencies
run: |
python -m pip install coverage[toml]
python -m pip install coverage[toml]~=6.6.0b1
- name: Retrieve coverage data
uses: actions/download-artifact@v3
with:
name: backend-coverage-data
- name: Normalize paths in coverage data
run: |
# See https://github.com/nedbat/coveragepy/issues/991
for coverage in `ls .coverage.*`; do
sqlite3 $coverage "update file set path = replace(path, '\\', '/')"
done
- name: Combine coverage
run: |
python -m coverage combine
Expand Down
20 changes: 3 additions & 17 deletions android/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,7 @@ build-backend = "setuptools.build_meta"
parallel = true
branch = true
relative_files = true
source_pkgs = ["toga_android"]

[tool.coverage.paths]
source = [
"src",
"**/site-packages"
]

[tool.coverage.report]
show_missing = true
skip_covered = true
skip_empty = true
precision = 1
exclude_lines = [
"pragma: no cover",
"@(abc\\.)?abstractmethod",
"NotImplementedError\\(\\)"
]
# See notes in the root pyproject.toml file.
source = ["src"]
source_pkgs = ["toga_android"]
1 change: 1 addition & 0 deletions changes/1673.misc.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Corrected coverage path mapping.
20 changes: 3 additions & 17 deletions cocoa/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,7 @@ build-backend = "setuptools.build_meta"
parallel = true
branch = true
relative_files = true
source_pkgs = ["toga_cocoa"]

[tool.coverage.paths]
source = [
"src",
"**/site-packages"
]

[tool.coverage.report]
show_missing = true
skip_covered = true
skip_empty = true
precision = 1
exclude_lines = [
"pragma: no cover",
"@(abc\\.)?abstractmethod",
"NotImplementedError\\(\\)"
]
# See notes in the root pyproject.toml file.
source = ["src"]
source_pkgs = ["toga_cocoa"]
20 changes: 3 additions & 17 deletions core/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,7 @@ build-backend = "setuptools.build_meta"
parallel = true
branch = true
relative_files = true
source_pkgs = ["toga", "toga_dummy"]

[tool.coverage.paths]
source = [
"src",
"**/site-packages"
]

[tool.coverage.report]
show_missing = true
skip_covered = true
skip_empty = true
precision = 1
exclude_lines = [
"pragma: no cover",
"@(abc\\.)?abstractmethod",
"NotImplementedError\\(\\)"
]
# See notes in the root pyproject.toml file.
source = ["src", "../dummy/src"]
source_pkgs = ["toga", "toga_dummy"]
20 changes: 3 additions & 17 deletions gtk/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,7 @@ build-backend = "setuptools.build_meta"
parallel = true
branch = true
relative_files = true
source_pkgs = ["toga_gtk"]

[tool.coverage.paths]
source = [
"src",
"**/site-packages"
]

[tool.coverage.report]
show_missing = true
skip_covered = true
skip_empty = true
precision = 1
exclude_lines = [
"pragma: no cover",
"@(abc\\.)?abstractmethod",
"NotImplementedError\\(\\)"
]
# See notes in the root pyproject.toml file.
source = ["src"]
source_pkgs = ["toga_gtk"]
20 changes: 3 additions & 17 deletions iOS/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,7 @@ build-backend = "setuptools.build_meta"
parallel = true
branch = true
relative_files = true
source_pkgs = ["toga_iOS"]

[tool.coverage.paths]
source = [
"src",
"**/site-packages"
]

[tool.coverage.report]
show_missing = true
skip_covered = true
skip_empty = true
precision = 1
exclude_lines = [
"pragma: no cover",
"@(abc\\.)?abstractmethod",
"NotImplementedError\\(\\)"
]
# See notes in the root pyproject.toml file.
source = ["src"]
source_pkgs = ["toga_iOS"]
62 changes: 31 additions & 31 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,58 +1,58 @@
# The coverage settings in this file only control `coverage combine` and `coverage report`.
# `coverage run` is controlled by the pyproject.toml files in each package's subdirectory.
#
# To view coverage reports locally, run something like this in the repository root
# directory:
#
# tox -c core -e py && coverage combine core/.coverage* && coverage report

[tool.coverage.run]
parallel = true
branch = true
relative_files = true
source = [
"android",
"cocoa",
"core",
"dummy",
"gtk",
"iOS",
"web",
"winforms",
]

# In each subdirectory's pyproject.toml, we use both of the following settings:
# * `source_pkgs`: detects the given packages no matter where they're imported from.
# * `source`: detects all files in the given directory, including files that are
# never imported by the tests.
#
# When running through `tox`, this will produce duplicate entries which must be merged
# with `coverage combine` using the lists below. In each list, the first item is a path to
# a source code directory, and the other items are paths in the coverage data which will
# be mapped to that directory. The order of the lists is significant, but their names are
# not.
[tool.coverage.paths]
android = [
"android/src/toga_android",
"src/toga_android",
"**/site-packages/toga_android",
"**/toga_android",
]
cocoa = [
"cocoa/src/toga_cocoa",
"src/toga_cocoa",
"**/site-packages/toga_cocoa",
]
core = [
"core/src/toga",
"src/toga",
"**/site-packages/toga",
"**/toga_cocoa",
]
dummy = [
"dummy/src/toga_dummy",
"src/toga_dummy",
"**/site-packages/toga_dummy",
"**/toga_dummy",
]
gtk = [
"gtk/src/toga_gtk",
"src/toga_gtk",
"**/site-packages/toga_gtk",
"**/toga_gtk",
]
iOS = [
"iOS/src/toga_iOS",
"src/toga_iOS",
"**/site-packages/toga_iOS",
"**/toga_iOS",
]
web = [
"web/src/toga_web",
"src/toga_web",
"**/site-packages/toga_web",
"**/toga_web",
]
winforms = [
"winforms/src/toga_winforms",
"src/toga_winforms",
"**/site-packages/toga_winforms",
"**/toga_winforms",
]
# This one must come last, otherwise the wildcard would match too much, because the
# repository root directory is probably also called "toga".
core = [
"core/src/toga",
"**/toga",
]

[tool.coverage.report]
Expand Down
20 changes: 3 additions & 17 deletions web/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,7 @@ build-backend = "setuptools.build_meta"
parallel = true
branch = true
relative_files = true
source_pkgs = ["toga_web"]

[tool.coverage.paths]
source = [
"src",
"**/site-packages"
]

[tool.coverage.report]
show_missing = true
skip_covered = true
skip_empty = true
precision = 1
exclude_lines = [
"pragma: no cover",
"@(abc\\.)?abstractmethod",
"NotImplementedError\\(\\)"
]
# See notes in the root pyproject.toml file.
source = ["src"]
source_pkgs = ["toga_web"]
20 changes: 3 additions & 17 deletions winforms/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,7 @@ build-backend = "setuptools.build_meta"
parallel = true
branch = true
relative_files = true
source_pkgs = ["toga_winforms"]

[tool.coverage.paths]
source = [
"src",
"**/site-packages"
]

[tool.coverage.report]
show_missing = true
skip_covered = true
skip_empty = true
precision = 1
exclude_lines = [
"pragma: no cover",
"@(abc\\.)?abstractmethod",
"NotImplementedError\\(\\)"
]
# See notes in the root pyproject.toml file.
source = ["src"]
source_pkgs = ["toga_winforms"]