Skip to content

Commit c2fd265

Browse files
committed
Use pytest.importorskip for C-extension tests
As these bits may or may not be built depending on whether C-extensions are supported, have pytest skip them if they are not `import`able.
1 parent b7c5a81 commit c2fd265

File tree

3 files changed

+11
-0
lines changed

3 files changed

+11
-0
lines changed

numcodecs/tests/test_blosc.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@
66
import pytest
77

88

9+
pytest.importorskip("numcodecs.blosc")
10+
11+
912
from numcodecs import blosc
1013
from numcodecs.blosc import Blosc
1114
from numcodecs.tests.common import (check_encode_decode,

numcodecs/tests/test_lz4.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33

44
import numpy as np
5+
import pytest
6+
7+
8+
pytest.importorskip("numcodecs.lz4")
59

610

711
from numcodecs.lz4 import LZ4

numcodecs/tests/test_zstd.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33

44
import numpy as np
5+
import pytest
6+
7+
8+
pytest.importorskip("numcodecs.zstd")
59

610

711
from numcodecs.zstd import Zstd

0 commit comments

Comments
 (0)