示例#1
0
    def test_multi_chdir_popen(self, testdir):
        import os
        hm = GatewayManager(["popen"] * 2)
        testdir.tmpdir.chdir()
        hellopath = testdir.tmpdir.mkdir("hello")
        hm.makegateways()
        hm.multi_chdir("hello", inplacelocal=False)
        l = hm.multi_exec("import os ; channel.send(os.getcwd())").receive_each()
        assert len(l) == 2
        curwd = os.path.realpath(os.getcwd())
        assert l == [curwd] * 2

        hm.multi_chdir("hello")
        l = hm.multi_exec("import os ; channel.send(os.getcwd())").receive_each()
        assert len(l) == 2
        assert l[0] == l[1]
        assert l[0].startswith(curwd)
        assert l[0].endswith("hello")
示例#2
0
 def test_multi_chdir_popen_with_path(self, testdir):
     import os
     hm = GatewayManager(["popen//chdir=hello"] * 2)
     testdir.tmpdir.chdir()
     hellopath = testdir.tmpdir.mkdir("hello").realpath()
     hm.makegateways()
     l = hm.multi_exec("import os ; channel.send(os.getcwd())").receive_each()
     paths = [x[1] for x in l]
     assert l == [str(hellopath)] * 2
     py.test.raises(hm.RemoteError, 'hm.multi_chdir("world", inplacelocal=False)')
     worldpath = hellopath.mkdir("world")
     hm.multi_chdir("world", inplacelocal=False)
     l = hm.multi_exec("import os ; channel.send(os.getcwd())").receive_each()
     assert len(l) == 2
     assert l[0] == l[1]
     curwd = os.getcwd()
     assert l[0].startswith(curwd)
     assert l[0].endswith("world")
示例#3
0
    def test_multi_chdir_popen(self, testdir):
        import os
        hm = GatewayManager(["popen"] * 2)
        testdir.tmpdir.chdir()
        hellopath = testdir.tmpdir.mkdir("hello")
        hm.makegateways()
        hm.multi_chdir("hello", inplacelocal=False)
        l = hm.multi_exec(
            "import os ; channel.send(os.getcwd())").receive_each()
        assert len(l) == 2
        curwd = os.path.realpath(os.getcwd())
        assert l == [curwd] * 2

        hm.multi_chdir("hello")
        l = hm.multi_exec(
            "import os ; channel.send(os.getcwd())").receive_each()
        assert len(l) == 2
        assert l[0] == l[1]
        assert l[0].startswith(curwd)
        assert l[0].endswith("hello")
示例#4
0
 def test_multi_chdir_popen_with_path(self, testdir):
     import os
     hm = GatewayManager(["popen//chdir=hello"] * 2)
     testdir.tmpdir.chdir()
     hellopath = testdir.tmpdir.mkdir("hello").realpath()
     hm.makegateways()
     l = hm.multi_exec(
         "import os ; channel.send(os.getcwd())").receive_each()
     paths = [x[1] for x in l]
     assert l == [str(hellopath)] * 2
     py.test.raises(hm.RemoteError,
                    'hm.multi_chdir("world", inplacelocal=False)')
     worldpath = hellopath.mkdir("world")
     hm.multi_chdir("world", inplacelocal=False)
     l = hm.multi_exec(
         "import os ; channel.send(os.getcwd())").receive_each()
     assert len(l) == 2
     assert l[0] == l[1]
     curwd = os.getcwd()
     assert l[0].startswith(curwd)
     assert l[0].endswith("world")