Skip to content

Commit

Permalink
Fix code coverage (#432)
Browse files Browse the repository at this point in the history
* Add codecov logging and function check

* revert codecov config changes

* add text report

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* try removing source

* specify source using CLI

* run coverage directly

* remove misleading __init__.py

* remove hatch config, oops

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
flying-sheep and pre-commit-ci[bot] authored Nov 10, 2023
1 parent 9f96549 commit af09b16
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 14 deletions.
8 changes: 7 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,13 @@ jobs:
MPLBACKEND: agg
PLATFORM: ${{ matrix.os }}
DISPLAY: :42
run: pytest -v --cov --color=yes
run: coverage run -m pytest -v --color=yes

- name: Show coverage report
run: coverage report -m

- name: Upload coverage
uses: codecov/codecov-action@v3
with:
fail_ci_if_error: true
verbose: true
21 changes: 12 additions & 9 deletions codecov.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
comment: false
codecov:
require_ci_to_pass: no

coverage:
status:
project:
default:
target: auto
patch:
default:
enabled: no
ignore:
- "test/"
github_checks:
annotations: false
# Require 1% coverage, i.e., succeed as long as coverage collection works
target: 1
patch: false
changes: false

comment:
layout: diff, flags, files
behavior: once
require_base: no
6 changes: 3 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -100,20 +100,20 @@ doc = [
]
test = [
"pytest",
"pytest-cov",
"coverage",
]

[tool.hatch.version]
source = "vcs"

[tool.coverage.run]
source = ["pertpy"]
source_pkgs = ["pertpy"]
omit = [
"**/test_*.py",
]

[tool.pytest.ini_options]
testpaths = "pertpy/tests"
testpaths = "tests"
xfail_strict = true
addopts = [
"--import-mode=importlib", # allow using test files with same name
Expand Down
1 change: 0 additions & 1 deletion tests/__init__.py

This file was deleted.

0 comments on commit af09b16

Please sign in to comment.