Skip to content

Commit e9772ac

Browse files
maxrjonesd-v-b
andauthored
Add hatch command for html coverage report (#2721)
* Add hatch command for html coverage report * Fix grammer * Use more informative alias in contrib guide --------- Co-authored-by: Davis Bennett <[email protected]>
1 parent 31d377b commit e9772ac

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

docs/developers/contributing.rst

+7-3
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ you can do something like the following::
9898
To verify that your development environment is working, you can run the unit tests
9999
for one of the test environments, e.g.::
100100

101-
$ hatch env run --env test.py3.12-2.1-optional run
101+
$ hatch env run --env test.py3.12-2.1-optional run-pytest
102102

103103
Creating a branch
104104
~~~~~~~~~~~~~~~~~
@@ -140,7 +140,7 @@ Zarr includes a suite of unit tests. The simplest way to run the unit tests
140140
is to activate your development environment
141141
(see `creating a development environment`_ above) and invoke::
142142

143-
$ hatch env run --env test.py3.12-2.1-optional run
143+
$ hatch env run --env test.py3.12-2.1-optional run-pytest
144144

145145
All tests are automatically run via GitHub Actions for every pull
146146
request and must pass before code can be accepted. Test coverage is
@@ -190,9 +190,13 @@ Both unit tests and docstring doctests are included when computing coverage. Run
190190

191191
$ hatch env run --env test.py3.12-2.1-optional run-coverage
192192

193-
will automatically run the test suite with coverage and produce a coverage report.
193+
will automatically run the test suite with coverage and produce a XML coverage report.
194194
This should be 100% before code can be accepted into the main code base.
195195

196+
You can also generate an HTML coverage report by running::
197+
198+
$ hatch env run --env test.py3.12-2.1-optional run-coverage-html
199+
196200
When submitting a pull request, coverage will also be collected across all supported
197201
Python versions via the Codecov service, and will be reported back within the pull
198202
request. Codecov coverage must also be 100% before code can be accepted.

pyproject.toml

+2
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,9 @@ features = ["gpu"]
149149
[tool.hatch.envs.test.scripts]
150150
run-coverage = "pytest --cov-config=pyproject.toml --cov=pkg --cov-report xml --cov=src --junitxml=junit.xml -o junit_family=legacy"
151151
run-coverage-gpu = "pip install cupy-cuda12x && pytest -m gpu --cov-config=pyproject.toml --cov=pkg --cov-report xml --cov=src --junitxml=junit.xml -o junit_family=legacy"
152+
run-coverage-html = "pytest --cov-config=pyproject.toml --cov=pkg --cov-report html --cov=src"
152153
run = "run-coverage --no-cov"
154+
run-pytest = "run"
153155
run-verbose = "run-coverage --verbose"
154156
run-mypy = "mypy src"
155157
run-hypothesis = "pytest --hypothesis-profile ci tests/test_properties.py tests/test_store/test_stateful*"

0 commit comments

Comments
 (0)