Skip to content

Commit 68544d3

Browse files
committed
TEST: Update NBS import test
1 parent 7e83fac commit 68544d3

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

nipype/interfaces/cmtk/tests/test_nbs.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import numpy as np
55
import networkx as nx
66
import pytest
7+
from nibabel.testing import clear_and_catch_warnings
78

89
have_cv = True
910
try:
@@ -34,14 +35,17 @@ def test_importerror(creating_graphs, tmpdir):
3435
group1 = graphlist[:3]
3536
group2 = graphlist[3:]
3637

37-
nbs = NetworkBasedStatistic()
38+
with clear_and_catch_warnings() as w:
39+
nbs = NetworkBasedStatistic()
40+
assert len(w) == 1
41+
assert str(w.message).startswith('Unable to import cviewer')
3842
nbs.inputs.in_group1 = group1
3943
nbs.inputs.in_group2 = group2
4044
nbs.inputs.edge_key = "weight"
4145

4246
with pytest.raises(ImportError) as e:
4347
nbs.run()
44-
assert "cviewer library is not available" == str(e.value)
48+
assert "No module named 'cviewer'" == str(e.value)
4549

4650

4751
@pytest.mark.skipif(not have_cv, reason="cviewer has to be available")

0 commit comments

Comments
 (0)