Skip to content

Commit 8e5e52e

Browse files
committed
BF(workaround): to make nose not blow during doctest if fuse is N/A
1 parent f5cb431 commit 8e5e52e

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

nibabel/cmdline/dicomfs.py

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,18 @@
1616
import time
1717
import locale
1818
import logging
19-
import fuse
19+
20+
21+
class dummy_fuse(object):
22+
"""Dummy fuse "module" so that nose does not blow during doctests"""
23+
Fuse = object
24+
25+
26+
try:
27+
import fuse
28+
except ImportError:
29+
fuse = dummy_fuse
30+
2031
import nibabel as nib
2132
import nibabel.dft as dft
2233

@@ -46,6 +57,9 @@ def __str__(self):
4657
class DICOMFS(fuse.Fuse):
4758

4859
def __init__(self, *args, **kwargs):
60+
if fuse is dummy_fuse:
61+
raise RuntimeError(
62+
"fuse module is not available, install it to use DICOMFS")
4963
self.followlinks = kwargs.pop('followlinks', False)
5064
fuse.Fuse.__init__(self, *args, **kwargs)
5165
self.fhs = {}

0 commit comments

Comments
 (0)