Skip to content

Commit 0a1f741

Browse files
committed
FIX: Only run SSHDataGrabber tests in local SSH server is running.
1 parent d08a4b1 commit 0a1f741

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

nipype/interfaces/tests/test_io.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,26 @@
3838
except ImportError:
3939
noboto3 = True
4040

41+
# Check for paramiko
4142
try:
4243
import paramiko
4344
no_paramiko = False
45+
46+
# Check for localhost SSH Server
47+
# FIXME: Tests requiring this are never run on CI
48+
try:
49+
proxy = None
50+
client = paramiko.SSHClient()
51+
client.load_system_host_keys()
52+
client.set_missing_host_key_policy(paramiko.AutoAddPolicy())
53+
client.connect('localhost', username=os.getenv('USER'), sock=proxy)
54+
55+
no_local_ssh = False
56+
57+
except (paramiko.SSHException,
58+
paramiko.ssh_exception.NoValidConnectionsError):
59+
no_local_ssh = True
60+
4461
except ImportError:
4562
no_paramiko = True
4663

@@ -621,6 +638,7 @@ def test_bids_infields_outfields(tmpdir):
621638

622639

623640
@pytest.mark.skipif(no_paramiko, reason="paramiko library is not available")
641+
@pytest.mark.skipif(no_local_ssh, reason="SSH Server is not running")
624642
def test_SSHDataGrabber(tmpdir):
625643
"""Test SSHDataGrabber by connecting to localhost and collecting some data.
626644
"""

0 commit comments

Comments
 (0)