From 928ee96ceb9a1bcfe6e2d982374233564c8c0582 Mon Sep 17 00:00:00 2001 From: David Stansby Date: Wed, 13 Nov 2024 12:32:50 +0000 Subject: [PATCH 1/3] Ignore some lines for coverage --- numcodecs/checksum32.py | 2 +- numcodecs/tests/test_zarr3.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/numcodecs/checksum32.py b/numcodecs/checksum32.py index d5f6a8da..79212ff2 100644 --- a/numcodecs/checksum32.py +++ b/numcodecs/checksum32.py @@ -10,7 +10,7 @@ from .jenkins import jenkins_lookup3 if TYPE_CHECKING: - from typing_extensions import Buffer + from typing_extensions import Buffer # pragma: no cover CHECKSUM_LOCATION = Literal['start', 'end'] diff --git a/numcodecs/tests/test_zarr3.py b/numcodecs/tests/test_zarr3.py index afb77136..65796a36 100644 --- a/numcodecs/tests/test_zarr3.py +++ b/numcodecs/tests/test_zarr3.py @@ -8,7 +8,7 @@ if not TYPE_CHECKING: zarr = pytest.importorskip("zarr") else: - import zarr + import zarr # pragma: no cover import zarr.storage from zarr.core.common import JSON From fe515cab0a4f1dae0998af1834382a5a2ae05e90 Mon Sep 17 00:00:00 2001 From: David Stansby Date: Thu, 14 Nov 2024 14:01:22 +0000 Subject: [PATCH 2/3] Move code coverage skips to branches Co-authored-by: jakirkham --- numcodecs/checksum32.py | 4 ++-- numcodecs/tests/test_zarr3.py | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/numcodecs/checksum32.py b/numcodecs/checksum32.py index 79212ff2..180907cc 100644 --- a/numcodecs/checksum32.py +++ b/numcodecs/checksum32.py @@ -9,8 +9,8 @@ from .compat import ensure_contiguous_ndarray, ndarray_copy from .jenkins import jenkins_lookup3 -if TYPE_CHECKING: - from typing_extensions import Buffer # pragma: no cover +if TYPE_CHECKING: # pragma: no cover + from typing_extensions import Buffer CHECKSUM_LOCATION = Literal['start', 'end'] diff --git a/numcodecs/tests/test_zarr3.py b/numcodecs/tests/test_zarr3.py index 65796a36..b51c6502 100644 --- a/numcodecs/tests/test_zarr3.py +++ b/numcodecs/tests/test_zarr3.py @@ -5,9 +5,10 @@ import numpy as np import pytest -if not TYPE_CHECKING: - zarr = pytest.importorskip("zarr") +if TYPE_CHECKING: # pragma: no cover + import zarr else: + zarr = pytest.importorskip("zarr") import zarr # pragma: no cover import zarr.storage From bf2a6e894bc3dfe6b8951d02312e43c84d9d34ca Mon Sep 17 00:00:00 2001 From: David Stansby Date: Thu, 14 Nov 2024 14:01:42 +0000 Subject: [PATCH 3/3] Remove additional import Co-authored-by: jakirkham --- numcodecs/tests/test_zarr3.py | 1 - 1 file changed, 1 deletion(-) diff --git a/numcodecs/tests/test_zarr3.py b/numcodecs/tests/test_zarr3.py index b51c6502..d5b7fdc8 100644 --- a/numcodecs/tests/test_zarr3.py +++ b/numcodecs/tests/test_zarr3.py @@ -9,7 +9,6 @@ import zarr else: zarr = pytest.importorskip("zarr") - import zarr # pragma: no cover import zarr.storage from zarr.core.common import JSON