pytest: set default --cov, --cov-report (#2275)

* pytest: set default --cov, --cov-report

* Prevent ambiguity between packages and directories
This commit is contained in:
Adam J. Stewart 2024-09-10 17:15:24 +02:00 коммит произвёл GitHub
Родитель 6cee6b4a84
Коммит d4a7b7286f
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: B5690EEEBB952194
3 изменённых файлов: 10 добавлений и 8 удалений

6
.github/workflows/tests.yaml поставляемый
Просмотреть файл

@ -46,7 +46,7 @@ jobs:
run: pip list
- name: Run pytest checks
run: |
pytest --cov=torchgeo --cov-report=xml --durations=10
pytest --cov --cov-report=xml
python3 -m torchgeo --help
- name: Report coverage
uses: codecov/codecov-action@v4.5.0
@ -81,7 +81,7 @@ jobs:
run: pip list
- name: Run pytest checks
run: |
pytest --cov=torchgeo --cov-report=xml --durations=10
pytest --cov --cov-report=xml
python3 -m torchgeo --help
- name: Report coverage
uses: codecov/codecov-action@v4.5.0
@ -114,7 +114,7 @@ jobs:
run: pip list
- name: Run pytest checks
run: |
pytest --cov=torchgeo --cov-report=xml --durations=10
pytest --cov --cov-report=xml
python3 -m torchgeo --help
- name: Report coverage
uses: codecov/codecov-action@v4.5.0

Просмотреть файл

@ -56,7 +56,7 @@ For example, if you add a new dataset in ``torchgeo/datasets/foo.py``, you'll ne
.. code-block:: console
$ pytest --cov=torchgeo/datasets --cov-report=term-missing tests/datasets/test_foo.py
$ pytest --cov=torchgeo.datasets.foo tests/datasets/test_foo.py
========================= test session starts =========================
platform darwin -- Python 3.10.11, pytest-6.2.4, py-1.9.0, pluggy-0.13.0
rootdir: ~/torchgeo, configfile: pyproject.toml
@ -65,14 +65,12 @@ For example, if you add a new dataset in ``torchgeo/datasets/foo.py``, you'll ne
tests/datasets/test_foo.py ....... [100%]
---------- coverage: platform darwin, python 3.10.11-final-0 -----------
--------- coverage: platform darwin, python 3.10.11-final-0 -----------
Name Stmts Miss Cover Missing
-----------------------------------------------------------------------
torchgeo/datasets/__init__.py 26 0 100%
torchgeo/datasets/foo.py 177 62 65% 376-403, 429-496, 504-509
...
-----------------------------------------------------------------------
TOTAL 1709 920 46%
TOTAL 177 62 65%
========================== 7 passed in 6.20s ==========================

Просмотреть файл

@ -140,6 +140,10 @@ Documentation = "https://torchgeo.readthedocs.io"
exclude_also = [
"@overload",
]
show_missing = true
[tool.coverage.run]
source_pkgs = ["torchgeo"]
# https://mypy.readthedocs.io/en/stable/config_file.html
[tool.mypy]