mirror of
https://github.com/finegrain-ai/refiners.git
synced 2024-11-09 23:12:02 +00:00
add rye scripts for code coverage
This commit is contained in:
parent
1efb7a0e10
commit
cd64bb29e6
5
.gitignore
vendored
5
.gitignore
vendored
|
@ -32,3 +32,8 @@ wandb/
|
|||
|
||||
# lock files
|
||||
requirements-dev.lock
|
||||
|
||||
# coverage.py
|
||||
htmlcov/
|
||||
.coverage
|
||||
.coverage.*
|
||||
|
|
|
@ -68,3 +68,15 @@ You can enforce running tests on CPU. Tests that require a GPU will be skipped.
|
|||
```bash
|
||||
REFINERS_TEST_DEVICE=cpu rye run pytest
|
||||
```
|
||||
|
||||
You can collect [code coverage](https://github.com/nedbat/coveragepy) data while running tests with, e.g.:
|
||||
|
||||
```bash
|
||||
rye run test-cov
|
||||
```
|
||||
|
||||
Then, browse the corresponding HTML report with:
|
||||
|
||||
```bash
|
||||
rye run serve-cov-report
|
||||
```
|
||||
|
|
|
@ -69,6 +69,11 @@ allow-direct-references = true
|
|||
[tool.rye.scripts]
|
||||
lint = { chain = ["ruff format .", "ruff --fix ."] }
|
||||
serve-docs = "mkdocs serve"
|
||||
test-cov = "coverage run -m pytest"
|
||||
# Work around for "Couldn't parse" errors due to e.g. opencv-python:
|
||||
# https://github.com/nedbat/coveragepy/issues/1653
|
||||
build-html-cov = { cmd = "coverage html", env = { PYTHONWARNINGS = "ignore:Couldn't parse::coverage.report_core" } }
|
||||
serve-cov-report = { chain = ["build-html-cov", "python -m http.server 8080 -b 127.0.0.1 -d htmlcov"]}
|
||||
|
||||
[tool.black]
|
||||
line-length = 120
|
||||
|
@ -99,3 +104,10 @@ include = ["src/refiners", "tests", "scripts"]
|
|||
strict = ["*"]
|
||||
exclude = ["**/__pycache__", "tests/weights"]
|
||||
reportMissingTypeStubs = "warning"
|
||||
|
||||
[tool.coverage.run]
|
||||
branch = true
|
||||
|
||||
# Also apply to HTML output, where appropriate
|
||||
[tool.coverage.report]
|
||||
ignore_errors = true # see `build-html-cov` for details
|
||||
|
|
Loading…
Reference in a new issue