Skip to content

Commit

Permalink
Enter blank into codecs tests to preserve indexes
Browse files Browse the repository at this point in the history
  • Loading branch information
joshmoore committed Aug 18, 2021
1 parent a84a166 commit fbe4d36
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
3 changes: 3 additions & 0 deletions numcodecs/tests/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,9 @@ def check_backwards_compatibility(codec_id, arrays, codecs, precision=None, pref

for j, codec in enumerate(codecs):

if codec is None:
pytest.skip("codec has been removed")

# setup a directory to hold encoded data
codec_dir = os.path.join(fixture_dir, 'codec.{:02d}'.format(j))
if not os.path.exists(codec_dir): # pragma: no cover
Expand Down
10 changes: 10 additions & 0 deletions numcodecs/tests/test_blosc.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
Blosc(cname='zlib', clevel=1, shuffle=0),
Blosc(cname='zstd', clevel=1, shuffle=1),
Blosc(cname='blosclz', clevel=1, shuffle=2),
None, # was snappy
Blosc(shuffle=Blosc.SHUFFLE, blocksize=0),
Blosc(shuffle=Blosc.SHUFFLE, blocksize=2**8),
Blosc(cname='lz4', clevel=1, shuffle=Blosc.NOSHUFFLE, blocksize=2**8),
Expand All @@ -60,6 +61,11 @@
]


def _skip_null(codec):
if codec is None:
pytest.skip("codec has been removed")


@pytest.fixture(scope='module', params=[True, False, None])
def use_threads(request):
return request.param
Expand All @@ -68,6 +74,7 @@ def use_threads(request):
@pytest.mark.parametrize('array', arrays)
@pytest.mark.parametrize('codec', codecs)
def test_encode_decode(array, codec):
_skip_null(codec)
check_encode_decode(array, codec)


Expand All @@ -76,6 +83,7 @@ def test_encode_decode(array, codec):
else pytest.param(x, marks=[pytest.mark.xfail])
for x in arrays])
def test_partial_decode(codec, array):
_skip_null(codec)
check_encode_decode_partial(array, codec)


Expand Down Expand Up @@ -255,6 +263,7 @@ def test_err_encode_object_buffer():

def test_decompression_error_handling():
for codec in codecs:
_skip_null(codec)
with pytest.raises(RuntimeError):
codec.decode(bytearray())
with pytest.raises(RuntimeError):
Expand All @@ -263,5 +272,6 @@ def test_decompression_error_handling():

def test_max_buffer_size():
for codec in codecs:
_skip_null(codec)
assert codec.max_buffer_size == 2**31 - 1
check_max_buffer_size(codec)

0 comments on commit fbe4d36

Please sign in to comment.