[svn r63091] report some more info on dist-setup

shift comments

--HG--
branch : trunk
This commit is contained in:
hpk
2009-03-19 19:25:13 +01:00
parent 6f2cca80ae
commit a94359c791
8 changed files with 42 additions and 18 deletions
+10 -4
View File
@@ -26,6 +26,7 @@ NO_ENDMARKER_WANTED = object()
class GatewaySpec(object):
python = None
def __init__(self, spec, defaultjoinpath="pyexecnetcache"):
self._spec = spec
if spec == "popen" or spec.startswith("popen:"):
parts = spec.split(":", 2)
self.type = self.address = parts.pop(0)
@@ -66,7 +67,7 @@ class GatewaySpec(object):
return bool(self.type == "popen" and not self.joinpath)
def __str__(self):
return "<GatewaySpec %s:%s>" % (self.address, self.joinpath)
return "<GatewaySpec %s>" % self._spec
__repr__ = __str__
def makegateway(self, waitclose=True):
@@ -102,13 +103,18 @@ class GatewayManager:
self.gateways = []
def trace(self, msg):
py._com.pyplugins.notify("trace", "gatewaymanage", msg)
self.notify("trace", "gatewaymanage", msg)
def notify(self, eventname, *args, **kwargs):
py._com.pyplugins.notify(eventname, *args, **kwargs)
def makegateways(self):
assert not self.gateways
for spec in self.specs:
self.trace("makegateway %s" %(spec))
self.gateways.append(spec.makegateway())
gw = spec.makegateway()
self.gateways.append(gw)
gw.id = "[%s]" % len(self.gateways)
self.notify("gwmanage_newgateway", gw)
def getgateways(self, remote=True, inplacelocal=True):
if not self.gateways and self.specs:
+2 -2
View File
@@ -565,9 +565,9 @@ class SocketGatewaySetup:
## cls.gw.exit()
## cls.proxygw.exit()
def getsshhost():
def getsshhost(withpython=False):
sshhost = py.test.config.getvalueorskip("sshhost")
if sshhost.find(":") != -1:
if not withpython and sshhost.find(":") != -1:
sshhost = sshhost.split(":")[0]
ssh = py.path.local.sysfind("ssh")
if not ssh:
+9 -3
View File
@@ -1,7 +1,5 @@
"""
tests for
- gateway specifications
- multi channels and multi gateways
- gateway management
- manage rsyncing of hosts
@@ -10,10 +8,18 @@
import py
from py.__.execnet.gwmanage import GatewayManager, HostRSync
pytest_plugins = "pytest_pytester"
class TestGatewayManagerPopen:
def test_hostmanager_popen_makegateway(self):
def test_hostmanager_popen_makegateway(self, eventrecorder):
hm = GatewayManager(["popen"] * 2)
hm.makegateways()
event = eventrecorder.popevent("gwmanage_newgateway")
gw = event.args[0]
assert gw.id == "[1]"
event = eventrecorder.popevent("gwmanage_newgateway")
gw = event.args[0]
assert gw.id == "[2]"
assert len(hm.gateways) == 2
hm.exit()
assert not len(hm.gateways)