mirror of
https://github.com/kovidgoyal/kitty.git
synced 2024-11-14 22:57:37 +03:00
Get the multi file tests working for the receive kitten
This commit is contained in:
parent
e4986c489e
commit
995c447435
@ -391,8 +391,8 @@ func (self *manager) request_files() transmit_iterator {
|
||||
if f == nil {
|
||||
return 0, files_done
|
||||
}
|
||||
read_signature := self.use_rsync
|
||||
if read_signature && f.ftype == FileType_regular {
|
||||
read_signature := self.use_rsync && f.ftype == FileType_regular
|
||||
if read_signature {
|
||||
if s, err := os.Lstat(f.expanded_local_path); err == nil {
|
||||
read_signature = s.Size() > 4096
|
||||
} else {
|
||||
|
@ -165,6 +165,7 @@ class PtyFileTransmission(FileTransmission):
|
||||
self.pty.callbacks.ftc = self
|
||||
|
||||
def write_ftc_to_child(self, payload: FileTransmissionCommand, appendleft: bool = False, use_pending: bool = True) -> bool:
|
||||
# print('to kitten:', payload)
|
||||
self.pty.write_to_child('\x1b]' + payload.serialize(prefix_with_osc_code=True) + '\x1b\\', flush=False)
|
||||
return True
|
||||
|
||||
@ -172,7 +173,7 @@ class PtyFileTransmission(FileTransmission):
|
||||
class TransferPTY(PTY):
|
||||
|
||||
def __init__(self, cmd, cwd, allow=True, env=None):
|
||||
super().__init__(cmd, cwd=cwd, env=env)
|
||||
super().__init__(cmd, cwd=cwd, env=env, rows=200, columns=120)
|
||||
self.fc = PtyFileTransmission(self, allow=allow)
|
||||
|
||||
|
||||
@ -368,20 +369,6 @@ class TestFileTransmission(BaseTest):
|
||||
single_file('--compress=always')
|
||||
single_file('--transmit-deltas', '--compress=never')
|
||||
|
||||
def test_transfer_receive(self):
|
||||
self.direction_receive = True
|
||||
self.basic_transfer_tests()
|
||||
|
||||
def test_transfer_send(self):
|
||||
self.basic_transfer_tests()
|
||||
src = os.path.join(self.tdir, 'src')
|
||||
|
||||
# remote home
|
||||
fname = 'tstest-file'
|
||||
with set_paths(home=self.tdir), self.run_kitten([src, '~/'+fname]) as pty:
|
||||
pty.wait_till_child_exits(require_exit_code=0)
|
||||
os.remove(os.path.expanduser('~/'+fname))
|
||||
|
||||
def multiple_files(*cmd):
|
||||
src = os.path.join(self.tdir, 'msrc')
|
||||
dest = os.path.join(self.tdir, 'mdest')
|
||||
@ -398,7 +385,7 @@ class TestFileTransmission(BaseTest):
|
||||
mtime = st.st_mtime_ns
|
||||
if stat.S_ISDIR(st.st_mode):
|
||||
mtime = 0 # mtime is flaky for dirs on CI even empty ones
|
||||
return Entry(os.path.relpath(path, base), mtime, st.st_mode, st.st_nlink)
|
||||
return Entry(os.path.relpath(path, base), mtime, oct(st.st_mode), st.st_nlink)
|
||||
|
||||
def se(path):
|
||||
e = entry(path)
|
||||
@ -458,6 +445,25 @@ class TestFileTransmission(BaseTest):
|
||||
multiple_files('--transmit-deltas')
|
||||
multiple_files('--transmit-deltas')
|
||||
|
||||
def test_transfer_receive(self):
|
||||
self.direction_receive = True
|
||||
self.basic_transfer_tests()
|
||||
src = os.path.join(self.tdir, 'src')
|
||||
with open(src, 'wb') as s:
|
||||
s.write(self.src_data)
|
||||
|
||||
def test_transfer_send(self):
|
||||
self.basic_transfer_tests()
|
||||
src = os.path.join(self.tdir, 'src')
|
||||
with open(src, 'wb') as s:
|
||||
s.write(self.src_data)
|
||||
|
||||
# remote home
|
||||
fname = 'tstest-file'
|
||||
with set_paths(home=self.tdir), self.run_kitten([src, '~/'+fname]) as pty:
|
||||
pty.wait_till_child_exits(require_exit_code=0)
|
||||
os.remove(os.path.expanduser('~/'+fname))
|
||||
|
||||
# mirror mode
|
||||
src_home = os.path.join(self.tdir, 'misrc')
|
||||
os.mkdir(src_home)
|
||||
|
Loading…
Reference in New Issue
Block a user