Skip to content

Commit dfcd97b

Browse files
authored
tests: clear the host sftp memoization cache before setting up the mock
1 parent ac2882a commit dfcd97b

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

tests/test_connectors/test_ssh.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1173,6 +1173,9 @@ def test_get_sftp_fail(self, fake_sftp_client, fake_ssh_client):
11731173
host = inventory.get_host("anotherhost")
11741174
host.connect()
11751175

1176+
# Clear the memoization cache to ensure the exception gets raised
1177+
host.connector.get_file_transfer_connection.cache.clear()
1178+
11761179
fake_sftp_client.from_transport.side_effect = make_raise_exception_function(SSHException)
11771180

11781181
fake_open = mock.mock_open(read_data="test!")

0 commit comments

Comments
 (0)