@@ -71,22 +71,24 @@ def test_gambaterm_ssh(ssh_config: Path, gambaterm_config: Path) -> None:
7171 )
7272 assert server .stdout .readline () == "Running SSH server on 127.0.0.1:8022...\n "
7373 assert (gambaterm_config / "ssh_host_key" ).exists ()
74- client = Popen (
75- f"ssh -tt -q localhost -p 8022 -i { ssh_config / 'id_rsa' } -o StrictHostKeyChecking=no" ,
76- shell = True ,
77- stdin = PIPE ,
78- stdout = PIPE ,
79- stderr = PIPE ,
80- text = True ,
81- env = {** os .environ , "TERM" : "xterm-256color" },
82- )
83- assert client .stdout is not None
84- assert client .stderr is not None
85- client .wait (timeout = 5 )
86- client_stdout = client .stdout .read ()
87- client_stderr = client .stderr .read ()
88- assert client .returncode == 0
89- assert client_stderr == ""
74+
75+ async def ssh_client () -> str :
76+ async with asyncssh .connect (
77+ host = "127.0.0.1" ,
78+ port = 8022 ,
79+ client_keys = [str (ssh_config / "id_rsa" )],
80+ known_hosts = None ,
81+ username = os .environ .get ("USER" , "user" ),
82+ ) as conn :
83+ result = await conn .run (
84+ "" ,
85+ term_type = "xterm-256color" ,
86+ term_size = (80 , 24 ),
87+ )
88+ assert isinstance (result .stdout , str )
89+ return result .stdout
90+
91+ client_stdout = asyncio .run (ssh_client ())
9092 assert "| test_rom.gb |" in client_stdout
9193 if sys .platform == "linux" :
9294 assert "▀ ▄▄ ▀" in client_stdout
0 commit comments