diff options
author | Benedikt <wisp3rwind@posteo.eu> | 2024-05-04 12:21:51 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-05-04 12:21:51 +0200 |
commit | 329098a0b4f009b91d0a981112ffe0a9f96484f3 (patch) | |
tree | 6489da83940bfee51c1eb2926e09c754ac771cad | |
parent | 34a59f98b3bc73bf3f2593150c5eb75427f4247c (diff) | |
parent | cdaefe698c8deec5b1b87a3416ad6775ee8e644d (diff) |
Merge pull request #5220 from snejus/improve-build-output-and-coverage
Improve GitHub build output and configure coverage
-rw-r--r-- | .coveragerc | 10 | ||||
-rw-r--r-- | .github/workflows/ci.yaml | 13 | ||||
-rw-r--r-- | setup.cfg | 40 | ||||
-rwxr-xr-x | setup.py | 2 | ||||
-rw-r--r-- | tox.ini | 8 |
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 @@ -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 @@ -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", @@ -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 |