Skip to content

Commit b65844d

Browse files
committed
BF(workaround): skip test_diff if hypothesis is not importable
Apparently hypothesis is quite a tricky beast. It might either fail to install on elderly systems from source tarball, or even if it is installable, apparently might rely on some coverage API which is present only in more recent versions and thus fail upon import. All those are of relevance for older systems and only for testing.
1 parent 7877add commit b65844d

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

nibabel/tests/test_diff.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,13 @@
77
from os.path import (dirname, join as pjoin, abspath)
88
import numpy as np
99

10-
from hypothesis import given
11-
import hypothesis.strategies as st
12-
10+
try:
11+
import hypothesis
12+
from hypothesis import given
13+
import hypothesis.strategies as st
14+
except Exception as exc:
15+
from nose import SkipTest
16+
raise SkipTest("Failed to import hypothesis or its components: %s" % exc)
1317

1418
DATA_PATH = abspath(pjoin(dirname(__file__), 'data'))
1519

0 commit comments

Comments
 (0)