[svn r63219] fixing tests to care for underlying symlinked working directories

--HG--
branch : trunk
This commit is contained in:
hpk 2009-03-23 03:07:53 +01:00
parent d50e4892a3
commit af39c9850e
3 changed files with 7 additions and 6 deletions

View File

@ -77,7 +77,7 @@ class TestGatewayManagerPopen:
import os import os
hm = GatewayManager(["popen//chdir=hello"] * 2) hm = GatewayManager(["popen//chdir=hello"] * 2)
testdir.tmpdir.chdir() testdir.tmpdir.chdir()
hellopath = testdir.tmpdir.mkdir("hello") hellopath = testdir.tmpdir.mkdir("hello").realpath()
hm.makegateways() hm.makegateways()
l = hm.multi_exec("import os ; channel.send(os.getcwd())").receive_each() l = hm.multi_exec("import os ; channel.send(os.getcwd())").receive_each()
paths = [x[1] for x in l] paths = [x[1] for x in l]
@ -101,13 +101,13 @@ class TestGatewayManagerPopen:
hm.multi_chdir("hello", inplacelocal=False) hm.multi_chdir("hello", inplacelocal=False)
l = hm.multi_exec("import os ; channel.send(os.getcwd())").receive_each() l = hm.multi_exec("import os ; channel.send(os.getcwd())").receive_each()
assert len(l) == 2 assert len(l) == 2
assert l == [os.getcwd()] * 2 curwd = os.path.realpath(os.getcwd())
assert l == [curwd] * 2
hm.multi_chdir("hello") hm.multi_chdir("hello")
l = hm.multi_exec("import os ; channel.send(os.getcwd())").receive_each() l = hm.multi_exec("import os ; channel.send(os.getcwd())").receive_each()
assert len(l) == 2 assert len(l) == 2
assert l[0] == l[1] assert l[0] == l[1]
curwd = os.getcwd()
assert l[0].startswith(curwd) assert l[0].startswith(curwd)
assert l[0].endswith("hello") assert l[0].endswith("hello")

View File

@ -104,13 +104,13 @@ class TestMakegateway:
def test_popen_chdir_absolute(self, testdir): def test_popen_chdir_absolute(self, testdir):
gw = py.execnet.makegateway("popen//chdir=%s" % testdir.tmpdir) gw = py.execnet.makegateway("popen//chdir=%s" % testdir.tmpdir)
rinfo = gw._rinfo() rinfo = gw._rinfo()
assert rinfo.cwd == str(testdir.tmpdir) assert rinfo.cwd == str(testdir.tmpdir.realpath())
def test_popen_chdir_newsub(self, testdir): def test_popen_chdir_newsub(self, testdir):
testdir.chdir() testdir.chdir()
gw = py.execnet.makegateway("popen//chdir=hello") gw = py.execnet.makegateway("popen//chdir=hello")
rinfo = gw._rinfo() rinfo = gw._rinfo()
assert rinfo.cwd == str(testdir.tmpdir.join("hello")) assert rinfo.cwd == str(testdir.tmpdir.join("hello").realpath())
def test_ssh(self, specssh): def test_ssh(self, specssh):
sshhost = specssh.ssh sshhost = specssh.ssh

View File

@ -230,7 +230,8 @@ class DSession(Session):
if item not in self.item2nodes: if item not in self.item2nodes:
raise AssertionError(item, self.item2nodes) raise AssertionError(item, self.item2nodes)
nodes = self.item2nodes[item] nodes = self.item2nodes[item]
nodes.remove(node) if node in nodes: # the node might have gone down already
nodes.remove(node)
if not nodes: if not nodes:
del self.item2nodes[item] del self.item2nodes[item]
self.node2pending[node].remove(item) self.node2pending[node].remove(item)