Skip to content

Commit 329098a

Browse files
authored
Merge pull request beetbox#5220 from snejus/improve-build-output-and-coverage
Improve GitHub build output and configure coverage
2 parents 34a59f9 + cdaefe6 commit 329098a

File tree

5 files changed

+48
-25
lines changed

5 files changed

+48
-25
lines changed

.coveragerc

Lines changed: 0 additions & 10 deletions
This file was deleted.

.github/workflows/ci.yaml

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,11 @@ jobs:
4949
run: |
5050
tox -e py-test
5151
52-
- name: Test latest Python version with tox and get coverage
53-
if: matrix.python-version == '3.x'
52+
- name: Upload code coverage
53+
if: matrix.python-version == '3.7' && matrix.platform == 'ubuntu-latest'
5454
run: |
55-
tox -vv -e py-cov
55+
pip install codecov || true
56+
codecov || true
5657
5758
- name: Test latest Python version with tox and mypy
5859
if: matrix.python-version == '3.x'
@@ -63,12 +64,6 @@ jobs:
6364
run: |
6465
tox -vv -e py-mypy
6566
66-
- name: Upload code coverage
67-
if: matrix.python-version == '3.x'
68-
run: |
69-
pip install codecov || true
70-
codecov || true
71-
7267
test-docs:
7368
runs-on: ubuntu-latest
7469

setup.cfg

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,43 @@
1+
[tool:pytest]
2+
# do not litter the working directory
3+
cache_dir = /tmp/pytest_cache
4+
# slightly more verbose output
5+
console_output_style = count
6+
addopts =
7+
# show all skipped/failed/xfailed tests in the summary except passed
8+
-ra
9+
--strict-config
10+
# record coverage in these two packages
11+
--cov=beets
12+
--cov=beetsplug
13+
# save xml for coverage upload
14+
--cov-report=xml:.reports/coverage.xml
15+
# save html files for local dev use
16+
--cov-report=html:.reports/html
17+
# record coverage across logical branches
18+
--cov-branch
19+
# show which tests cover specific lines in the code (available in HTML)
20+
--cov-context=test
21+
22+
[coverage:run]
23+
data_file = .reports/coverage/data
24+
branch = true
25+
relative_files = true
26+
27+
[coverage:report]
28+
precision = 2
29+
skip_empty = true
30+
show_missing = true
31+
exclude_lines =
32+
pragma: no cover
33+
if TYPE_CHECKING
34+
if typing.TYPE_CHECKING
35+
raise AssertionError
36+
raise NotImplementedError
37+
38+
[coverage:html]
39+
show_contexts = true
40+
141
[flake8]
242
min-version = 3.6
343
accept-encodings = utf-8

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,11 +103,11 @@ def build_manpages():
103103
extras_require={
104104
"test": [
105105
"beautifulsoup4",
106-
"coverage",
107106
"flask",
108107
"mock",
109108
"pylast",
110109
"pytest",
110+
"pytest-cov",
111111
"python-mpd2",
112112
"python3-discogs-client>=2.3.15",
113113
"py7zr",

tox.ini

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,7 @@ deps =
2525
mypy: {[_mypy]deps}
2626
passenv = INTEGRATION_TEST
2727
commands =
28-
test: python -bb -m pytest -rs {posargs}
29-
cov: coverage run -m pytest -rs {posargs}
28+
test: python -m pytest {posargs}
3029
lint: python -m flake8 {posargs} {[_lint]files}
3130
mypy: mypy -p beets -p beetsplug
3231
mypy: mypy test
@@ -65,6 +64,5 @@ deps =
6564
black==24.2.0
6665
skip_install = True
6766
commands =
68-
isort beets beetsplug test --check
69-
black beets beetsplug test --check
70-
67+
isort beets beetsplug test --check --diff
68+
black beets beetsplug test --check --diff

0 commit comments

Comments
 (0)