summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBenedikt <wisp3rwind@posteo.eu>2024-05-04 12:21:51 +0200
committerGitHub <noreply@github.com>2024-05-04 12:21:51 +0200
commit329098a0b4f009b91d0a981112ffe0a9f96484f3 (patch)
tree6489da83940bfee51c1eb2926e09c754ac771cad
parent34a59f98b3bc73bf3f2593150c5eb75427f4247c (diff)
parentcdaefe698c8deec5b1b87a3416ad6775ee8e644d (diff)
Merge pull request #5220 from snejus/improve-build-output-and-coverage
Improve GitHub build output and configure coverage
-rw-r--r--.coveragerc10
-rw-r--r--.github/workflows/ci.yaml13
-rw-r--r--setup.cfg40
-rwxr-xr-xsetup.py2
-rw-r--r--tox.ini8
5 files changed, 48 insertions, 25 deletions
diff --git a/.coveragerc b/.coveragerc
deleted file mode 100644
index bcc99c18f..000000000
--- a/.coveragerc
+++ /dev/null
@@ -1,10 +0,0 @@
-[report]
-omit =
- */pyshared/*
- */python?.?/*
- */test/*
-exclude_lines =
- assert False
- raise NotImplementedError
- if __name__ == .__main__.:
- def __repr__
diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml
index f109f2e23..4e463af7c 100644
--- a/.github/workflows/ci.yaml
+++ b/.github/workflows/ci.yaml
@@ -49,10 +49,11 @@ jobs:
run: |
tox -e py-test
- - name: Test latest Python version with tox and get coverage
- if: matrix.python-version == '3.x'
+ - name: Upload code coverage
+ if: matrix.python-version == '3.7' && matrix.platform == 'ubuntu-latest'
run: |
- tox -vv -e py-cov
+ pip install codecov || true
+ codecov || true
- name: Test latest Python version with tox and mypy
if: matrix.python-version == '3.x'
@@ -63,12 +64,6 @@ jobs:
run: |
tox -vv -e py-mypy
- - name: Upload code coverage
- if: matrix.python-version == '3.x'
- run: |
- pip install codecov || true
- codecov || true
-
test-docs:
runs-on: ubuntu-latest
diff --git a/setup.cfg b/setup.cfg
index 344c457e0..c8bd6f21c 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -1,3 +1,43 @@
+[tool:pytest]
+# do not litter the working directory
+cache_dir = /tmp/pytest_cache
+# slightly more verbose output
+console_output_style = count
+addopts =
+ # show all skipped/failed/xfailed tests in the summary except passed
+ -ra
+ --strict-config
+ # record coverage in these two packages
+ --cov=beets
+ --cov=beetsplug
+ # save xml for coverage upload
+ --cov-report=xml:.reports/coverage.xml
+ # save html files for local dev use
+ --cov-report=html:.reports/html
+ # record coverage across logical branches
+ --cov-branch
+ # show which tests cover specific lines in the code (available in HTML)
+ --cov-context=test
+
+[coverage:run]
+data_file = .reports/coverage/data
+branch = true
+relative_files = true
+
+[coverage:report]
+precision = 2
+skip_empty = true
+show_missing = true
+exclude_lines =
+ pragma: no cover
+ if TYPE_CHECKING
+ if typing.TYPE_CHECKING
+ raise AssertionError
+ raise NotImplementedError
+
+[coverage:html]
+show_contexts = true
+
[flake8]
min-version = 3.6
accept-encodings = utf-8
diff --git a/setup.py b/setup.py
index 62bac6e4e..c69b703f8 100755
--- a/setup.py
+++ b/setup.py
@@ -103,11 +103,11 @@ setup(
extras_require={
"test": [
"beautifulsoup4",
- "coverage",
"flask",
"mock",
"pylast",
"pytest",
+ "pytest-cov",
"python-mpd2",
"python3-discogs-client>=2.3.15",
"py7zr",
diff --git a/tox.ini b/tox.ini
index 22d85a8c7..6f303e872 100644
--- a/tox.ini
+++ b/tox.ini
@@ -25,8 +25,7 @@ deps =
mypy: {[_mypy]deps}
passenv = INTEGRATION_TEST
commands =
- test: python -bb -m pytest -rs {posargs}
- cov: coverage run -m pytest -rs {posargs}
+ test: python -m pytest {posargs}
lint: python -m flake8 {posargs} {[_lint]files}
mypy: mypy -p beets -p beetsplug
mypy: mypy test
@@ -65,6 +64,5 @@ deps =
black==24.2.0
skip_install = True
commands =
- isort beets beetsplug test --check
- black beets beetsplug test --check
-
+ isort beets beetsplug test --check --diff
+ black beets beetsplug test --check --diff