コード例 #1
0
ファイル: test_channel.py プロジェクト: yili1992/execnet
    def test_3to2(self, makegateway):
        python = _find_version("2")
        gw = makegateway("popen//python=%s" % python)

        ch = gw.remote_exec("channel.send(channel.receive());" * 2)
        ch.send(bytes("a", "ascii"))
        res = ch.receive()
        assert isinstance(res, str)

        ch.reconfigure(py3str_as_py2str=True, py2str_as_py3str=False)

        ch.send("a")
        res = ch.receive()
        assert isinstance(res, bytes)

        gw.reconfigure(py3str_as_py2str=True, py2str_as_py3str=False)
        ch = gw.remote_exec("channel.send(channel.receive());" * 2)

        ch.send("a")
        res = ch.receive()
        assert isinstance(res, bytes)

        ch.reconfigure(py3str_as_py2str=False, py2str_as_py3str=True)
        ch.send(bytes("a", "ascii"))
        res = ch.receive()
        assert isinstance(res, str)

        gw.exit()
コード例 #2
0
ファイル: test_channel.py プロジェクト: pshv/execnet
    def test_3to2(self, makegateway):
        python = _find_version('2')
        gw = makegateway('popen//python=%s' % python)

        ch = gw.remote_exec('channel.send(channel.receive());'*2)
        ch.send(bytes('a', 'ascii'))
        res = ch.receive()
        assert isinstance(res, str)

        ch.reconfigure(py3str_as_py2str=True, py2str_as_py3str=False)

        ch.send('a')
        res = ch.receive()
        assert isinstance(res, bytes)

        gw.reconfigure(py3str_as_py2str=True, py2str_as_py3str=False)
        ch = gw.remote_exec('channel.send(channel.receive());'*2)

        ch.send('a')
        res = ch.receive()
        assert isinstance(res, bytes)

        ch.reconfigure(py3str_as_py2str=False, py2str_as_py3str=True)
        ch.send(bytes('a', 'ascii'))
        res = ch.receive()
        assert isinstance(res, str)

        gw.exit()
コード例 #3
0
ファイル: test_channel.py プロジェクト: bryan-lunt/execnet
    def test_3to2(self, makegateway):
        python = _find_version('2')
        gw = makegateway('popen//python=%s' % python)

        ch = gw.remote_exec('channel.send(channel.receive());'*2)
        ch.send(bytes('a', 'ascii'))
        res = ch.receive()
        assert isinstance(res, str)

        ch.reconfigure(py3str_as_py2str=True, py2str_as_py3str=False)

        ch.send('a')
        res = ch.receive()
        assert isinstance(res, bytes)

        gw.reconfigure(py3str_as_py2str=True, py2str_as_py3str=False)
        ch = gw.remote_exec('channel.send(channel.receive());'*2)

        ch.send('a')
        res = ch.receive()
        assert isinstance(res, bytes)

        ch.reconfigure(py3str_as_py2str=False, py2str_as_py3str=True)
        ch.send(bytes('a', 'ascii'))
        res = ch.receive()
        assert isinstance(res, str)

        gw.exit()