|
|
@@ -132,3 +132,16 @@ def test_terminated_ssh_is_reported_as_transport_interruption(monkeypatch,exit_c
|
|
|
with pytest.raises(transfer.TransferError) as error:
|
|
|
transfer.SSH('/data/prod2u/remote_transfer.py',0).request({'operation':'describe'})
|
|
|
assert error.value.code==255
|
|
|
+
|
|
|
+def test_cli_reports_unicode_paths_even_when_started_in_cp1252(tmp_path,monkeypatch):
|
|
|
+ import json
|
|
|
+ monkeypatch.setattr(transfer,'REMOTE_ROOT',tmp_path)
|
|
|
+ source=tmp_path/'源.bin';source.write_bytes(b'bytes')
|
|
|
+ destination=tmp_path/'目标.bin'
|
|
|
+ remote=LocalRemote()
|
|
|
+ monkeypatch.setattr(transfer,'SSH',lambda *args:remote)
|
|
|
+ output=io.BytesIO();stream=io.TextIOWrapper(output,encoding='cp1252')
|
|
|
+ monkeypatch.setattr(transfer.sys,'stdout',stream)
|
|
|
+ assert transfer.main(['--remote-worker','fixture','upload',str(source),str(destination)])==0
|
|
|
+ stream.flush()
|
|
|
+ assert json.loads(output.getvalue().decode('utf-8'))['destination']==str(destination)
|