Skip to content

Commit

Permalink
tests: skip_if_no_cl: skip on ImportError
Browse files Browse the repository at this point in the history
  • Loading branch information
rjw57 committed Sep 3, 2014
1 parent cf92c8f commit 7572209
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions tests/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def centre_indices(ndim=2,apron=8):
def summarise_mat(M, apron=8):
"""HACK to provide a 'summary' matrix consisting of the corners of the
matrix and summed versions of the sub matrices.
N.B. Keep this in sync with matlab/verif_m_to_npz.py.
"""
Expand All @@ -62,11 +62,15 @@ def summarise_cube(M, apron=4):
"""
return np.dstack(
[summarise_mat(M[:,:,i,...], apron) for i in xrange(M.shape[-2])]
)
)

def skip_if_no_cl(f):
@functools.wraps(f)
def wrapper(*args, **kwargs):
try:
import pyopencl
except ImportError:
raise SkipTest('Skipping due to no CL library being present')
try:
return f(*args, **kwargs)
except NoCLPresentError:
Expand Down

0 comments on commit 7572209

Please sign in to comment.