[svn r63149] always have a default chdir
--HG-- branch : trunk
This commit is contained in:
parent
78d1836d80
commit
c8da61a7d3
|
@ -12,9 +12,15 @@ NO_ENDMARKER_WANTED = object()
|
|||
class GatewayManager:
|
||||
RemoteError = RemoteError
|
||||
|
||||
def __init__(self, specs):
|
||||
self.specs = [py.execnet.XSpec(spec) for spec in specs]
|
||||
def __init__(self, specs, defaultchdir="pyexecnetcache"):
|
||||
self.gateways = []
|
||||
self.specs = []
|
||||
for spec in specs:
|
||||
if not isinstance(spec, py.execnet.XSpec):
|
||||
spec = py.execnet.XSpec(spec)
|
||||
if not spec.chdir and not spec.popen:
|
||||
spec.chdir = defaultchdir
|
||||
self.specs.append(spec)
|
||||
|
||||
def trace(self, msg):
|
||||
self.notify("trace", "gatewaymanage", msg)
|
||||
|
|
|
@ -11,6 +11,17 @@ from py.__.execnet.gwmanage import GatewayManager, HostRSync
|
|||
pytest_plugins = "pytest_pytester"
|
||||
|
||||
class TestGatewayManagerPopen:
|
||||
def test_popen_no_default_chdir(self):
|
||||
gm = GatewayManager(["popen"])
|
||||
assert gm.specs[0].chdir is None
|
||||
|
||||
def test_default_chdir(self):
|
||||
l = ["ssh=noco", "socket=xyz"]
|
||||
for spec in GatewayManager(l).specs:
|
||||
assert spec.chdir == "pyexecnetcache"
|
||||
for spec in GatewayManager(l, defaultchdir="abc").specs:
|
||||
assert spec.chdir == "abc"
|
||||
|
||||
def test_hostmanager_popen_makegateway(self, eventrecorder):
|
||||
hm = GatewayManager(["popen"] * 2)
|
||||
hm.makegateways()
|
||||
|
|
Loading…
Reference in New Issue