def test_2_to_3_bridge_can_send_binary_files(self, tmpdir, makegateway): python = _find_version('3') gw = makegateway('popen//python=%s' % python) source = tmpdir.ensure('source', dir=1) for i, content in enumerate('foo bar baz \x10foo'): source.join(str(i)).write(content) rsync = RSync(source) target = tmpdir.join('target') rsync.add_target(gw, target) rsync.send()
def test_2to3(self, makegateway): python = _find_version('3') gw = makegateway('popen//python=%s' % python) ch = gw.remote_exec('channel.send(channel.receive())') ch.send('a') res = ch.receive() assert isinstance(res, unicode) gw.reconfigure(py3str_as_py2str=True) ch = gw.remote_exec('channel.send(channel.receive())') ch.send('a') res = ch.receive() assert isinstance(res, str) gw.exit()
def test_3to2(self, makegateway): python = _find_version('2') gw = makegateway('popen//python=%s' % python) ch = gw.remote_exec('channel.send(channel.receive())') ch.send(bytes('a', 'ascii')) res = ch.receive() assert isinstance(res, str) gw.reconfigure(py3str_as_py2str=True, py2str_as_py3str=False) ch = gw.remote_exec('channel.send(channel.receive())') ch.send('a') res = ch.receive() assert isinstance(res, bytes) gw.exit()
def test_3to2(self, makegateway): python = _find_version("2") gw = makegateway("popen//python=%s" % python) ch = gw.remote_exec("channel.send(channel.receive())") ch.send(bytes("a", "ascii")) res = ch.receive() assert isinstance(res, str) gw.reconfigure(py3str_as_py2str=True, py2str_as_py3str=False) ch = gw.remote_exec("channel.send(channel.receive())") ch.send("a") res = ch.receive() assert isinstance(res, bytes) gw.exit()