Skip to content

Commit

Permalink
fix: codecov issues
Browse files Browse the repository at this point in the history
  • Loading branch information
germa89 committed Feb 10, 2025
1 parent 8465793 commit 337285b
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion tests/test_hpc.py
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,7 @@ class Test_SshSession:
@pytest.mark.parametrize("cmd", ["exec_command", "run"])
def test_failed_not_connected_after_started(self, cmd):
with patch("paramiko.client.SSHClient.connect") as mck_connect:
mck_connect.return_value = None
with pytest.raises(Exception, match="ssh session is not connected"):
with SshSession("myhost", "myuser", "mypass") as ssh:
ssh._connected = False
Expand Down Expand Up @@ -275,7 +276,7 @@ def test_submit(self):
assert mck_run.call_args_list[1].args[0] == f"cd {cwd};{cmd}"
assert mck_run.call_args_list[1].kwargs["environment"] == env

def test_submit(self):
def test_submit_fail(self):
with (
patch("paramiko.client.SSHClient.connect") as mck_connect,
patch("paramiko.client.SSHClient.close") as mck_close,
Expand All @@ -287,6 +288,7 @@ def test_submit(self):
error = "Failed to run command"

mck_run.side_effect = Exception(error)
mck_connect.return_value = None

with pytest.raises(Exception, match=f"Unexpected error occurred: {error}"):
with SshSession("myhost", "myuser", "mypass") as ssh:
Expand Down

0 comments on commit 337285b

Please sign in to comment.