mirror of
https://github.com/kovidgoyal/kitty
synced 2026-07-19 06:54:58 +02:00
Framework for testing with external programs via a PTY
This commit is contained in:
@@ -3,14 +3,30 @@
|
||||
|
||||
|
||||
import os
|
||||
from . import BaseTest
|
||||
import sys
|
||||
|
||||
from kittens.ssh.main import get_connection_data
|
||||
from kitty.utils import SSHConnectionData
|
||||
|
||||
from . import BaseTest
|
||||
|
||||
|
||||
class SSHTest(BaseTest):
|
||||
|
||||
def test_basic_pty_operations(self):
|
||||
pty = self.create_pty('echo hello')
|
||||
self.assertTrue(pty.wait_for_input_from_child())
|
||||
pty.process_input_from_child()
|
||||
self.ae(pty.screen_contents(), 'hello')
|
||||
pty = self.create_pty([sys.executable, '-c', '''\
|
||||
import array, fcntl, sys, termios
|
||||
buf = array.array('H', [0, 0, 0, 0])
|
||||
fcntl.ioctl(sys.stdout, termios.TIOCGWINSZ, buf)
|
||||
print(' '.join(map(str, buf)))'''], lines=13, cols=17)
|
||||
self.assertTrue(pty.wait_for_input_from_child())
|
||||
pty.process_input_from_child()
|
||||
self.ae(pty.screen_contents(), '13 17 0 0')
|
||||
|
||||
def test_ssh_connection_data(self):
|
||||
def t(cmdline, binary='ssh', host='main', port=None, identity_file=''):
|
||||
if identity_file:
|
||||
|
||||
Reference in New Issue
Block a user