6
6
import unittest
7
7
8
8
9
- from nose .tools import assert_raises
10
9
import numpy as np
11
10
from numpy .testing import assert_array_equal
12
11
from numcodecs import Zlib , Adler32
@@ -42,7 +41,7 @@ def test_open_array():
42
41
assert z .read_only
43
42
44
43
# path not found
45
- with assert_raises (ValueError ):
44
+ with pytest . raises (ValueError ):
46
45
open ('doesnotexist' , mode = 'r' )
47
46
48
47
@@ -69,10 +68,10 @@ def test_open_group():
69
68
70
69
71
70
def test_save_errors ():
72
- with assert_raises (ValueError ):
71
+ with pytest . raises (ValueError ):
73
72
# no arrays provided
74
73
save_group ('data/group.zarr' )
75
- with assert_raises (ValueError ):
74
+ with pytest . raises (ValueError ):
76
75
# no arrays provided
77
76
save ('data/group.zarr' )
78
77
@@ -427,7 +426,7 @@ def test_copy_array_skip_initialized(self):
427
426
assert not np .all (source ['foo/bar/baz' ][:] == dest ['baz' ][:])
428
427
429
428
if self .dest_h5py :
430
- with assert_raises (ValueError ):
429
+ with pytest . raises (ValueError ):
431
430
# not available with copy to h5py
432
431
copy (source ['foo/bar/baz' ], dest , if_exists = 'skip_initialized' )
433
432
@@ -575,10 +574,9 @@ def test_logging(self):
575
574
576
575
577
576
try :
578
- import h5py # no qa
579
- have_h5py = True
577
+ import h5py
580
578
except ImportError : # pragma: no cover
581
- have_h5py = False
579
+ h5py = None
582
580
583
581
584
582
def temp_h5f ():
@@ -589,7 +587,7 @@ def temp_h5f():
589
587
return h5f
590
588
591
589
592
- @pytest .mark .skipif (not have_h5py , reason = 'h5py not installed' )
590
+ @pytest .mark .skipif (h5py is None , reason = 'h5py not installed' )
593
591
class TestCopyHDF5ToZarr (TestCopy ):
594
592
595
593
def __init__ (self , * args , ** kwargs ):
@@ -600,7 +598,7 @@ def __init__(self, *args, **kwargs):
600
598
self .new_dest = group
601
599
602
600
603
- @pytest .mark .skipif (not have_h5py , reason = 'h5py not installed' )
601
+ @pytest .mark .skipif (h5py is None , reason = 'h5py not installed' )
604
602
class TestCopyZarrToHDF5 (TestCopy ):
605
603
606
604
def __init__ (self , * args , ** kwargs ):
@@ -611,7 +609,7 @@ def __init__(self, *args, **kwargs):
611
609
self .new_dest = temp_h5f
612
610
613
611
614
- @pytest .mark .skipif (not have_h5py , reason = 'h5py not installed' )
612
+ @pytest .mark .skipif (h5py is None , reason = 'h5py not installed' )
615
613
class TestCopyHDF5ToHDF5 (TestCopy ):
616
614
617
615
def __init__ (self , * args , ** kwargs ):
0 commit comments