Skip to content

Commit

Permalink
tests/util: skip tests if ssh is not available
Browse files Browse the repository at this point in the history
Those tests require access to the ssh binary, skip them if ssh is not
available in the test environment.

Signed-off-by: Rouven Czerwinski <r.czerwinski@pengutronix.de>
  • Loading branch information
Emantor committed Sep 16, 2021
1 parent abef525 commit 4c1d609
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions tests/test_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,7 @@ def test_sshmanager_remove_raise(sshmanager_fix):
with pytest.raises(ExecutionError):
sshmanager_fix.remove_connection(con)

@pytest.mark.skipif(not which("ssh"), reason="ssh not available")
def test_sshmanager_add_duplicate(sshmanager_fix):
host = 'localhost'
con = SSHConnection(host)
Expand All @@ -231,6 +232,7 @@ def test_sshmanager_add_duplicate(sshmanager_fix):

assert con_now == con_there

@pytest.mark.skipif(not which("ssh"), reason="ssh not available")
def test_sshmanager_add_new(sshmanager_fix):
host = 'other_host'
con = SSHConnection(host)
Expand All @@ -239,6 +241,7 @@ def test_sshmanager_add_new(sshmanager_fix):

assert con_now == con

@pytest.mark.skipif(not which("ssh"), reason="ssh not available")
def test_sshmanager_invalid_host_raise():
con = SSHConnection("nosuchhost.notavailable")
with pytest.raises(ExecutionError):
Expand Down

0 comments on commit 4c1d609

Please sign in to comment.