From 8dab473bf6235ef609e491c12710343babb40ceb Mon Sep 17 00:00:00 2001 From: Max Jones <14077947+maxrjones@users.noreply.github.com> Date: Thu, 16 Jan 2025 11:30:16 -0500 Subject: [PATCH 1/3] Add hatch command for html coverage report --- docs/developers/contributing.rst | 6 +++++- pyproject.toml | 2 ++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/docs/developers/contributing.rst b/docs/developers/contributing.rst index 71294826cb..c64bea9d31 100644 --- a/docs/developers/contributing.rst +++ b/docs/developers/contributing.rst @@ -190,9 +190,13 @@ Both unit tests and docstring doctests are included when computing coverage. Run $ hatch env run --env test.py3.12-2.1-optional run-coverage -will automatically run the test suite with coverage and produce a coverage report. +will automatically run the test suite with coverage and produce a XML coverage report. This should be 100% before code can be accepted into the main code base. +You can also generate a HTML rendered of the coverage report by running:: + + $ hatch env run --env test.py3.12-2.1-optional run-coverage-html + When submitting a pull request, coverage will also be collected across all supported Python versions via the Codecov service, and will be reported back within the pull request. Codecov coverage must also be 100% before code can be accepted. diff --git a/pyproject.toml b/pyproject.toml index a88e43c51d..00c9205a2c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -149,7 +149,9 @@ features = ["gpu"] [tool.hatch.envs.test.scripts] run-coverage = "pytest --cov-config=pyproject.toml --cov=pkg --cov-report xml --cov=src --junitxml=junit.xml -o junit_family=legacy" 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" +run-coverage-html = "pytest --cov-config=pyproject.toml --cov=pkg --cov-report html --cov=src" run = "run-coverage --no-cov" +run-pytest = "run" run-verbose = "run-coverage --verbose" run-mypy = "mypy src" run-hypothesis = "pytest --hypothesis-profile ci tests/test_properties.py tests/test_store/test_stateful*" From 90fc72d3a600ec256476e4c515593c4a1806714a Mon Sep 17 00:00:00 2001 From: Max Jones <14077947+maxrjones@users.noreply.github.com> Date: Thu, 16 Jan 2025 11:32:42 -0500 Subject: [PATCH 2/3] Fix grammer --- docs/developers/contributing.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/developers/contributing.rst b/docs/developers/contributing.rst index c64bea9d31..c9ff2d567b 100644 --- a/docs/developers/contributing.rst +++ b/docs/developers/contributing.rst @@ -193,7 +193,7 @@ Both unit tests and docstring doctests are included when computing coverage. Run will automatically run the test suite with coverage and produce a XML coverage report. This should be 100% before code can be accepted into the main code base. -You can also generate a HTML rendered of the coverage report by running:: +You can also generate an HTML coverage report by running:: $ hatch env run --env test.py3.12-2.1-optional run-coverage-html From 5b6079c3698f3825207a9bdec2aa185c26dc2634 Mon Sep 17 00:00:00 2001 From: Max Jones <14077947+maxrjones@users.noreply.github.com> Date: Thu, 16 Jan 2025 11:34:40 -0500 Subject: [PATCH 3/3] Use more informative alias in contrib guide --- docs/developers/contributing.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/developers/contributing.rst b/docs/developers/contributing.rst index c9ff2d567b..5582c6ae8f 100644 --- a/docs/developers/contributing.rst +++ b/docs/developers/contributing.rst @@ -98,7 +98,7 @@ you can do something like the following:: To verify that your development environment is working, you can run the unit tests for one of the test environments, e.g.:: - $ hatch env run --env test.py3.12-2.1-optional run + $ hatch env run --env test.py3.12-2.1-optional run-pytest Creating a branch ~~~~~~~~~~~~~~~~~ @@ -140,7 +140,7 @@ Zarr includes a suite of unit tests. The simplest way to run the unit tests is to activate your development environment (see `creating a development environment`_ above) and invoke:: - $ hatch env run --env test.py3.12-2.1-optional run + $ hatch env run --env test.py3.12-2.1-optional run-pytest All tests are automatically run via GitHub Actions for every pull request and must pass before code can be accepted. Test coverage is