[svn r63018] rename "--hosts" to "--gateways" to make naming more consistent with py.execnet
--HG-- branch : trunk
This commit is contained in:
parent
d626a63934
commit
b5b7f9b3a9
|
@ -63,7 +63,7 @@ class DSession(Session):
|
|||
config.getvalue('hosts')
|
||||
except KeyError:
|
||||
print "Please specify hosts for distribution of tests:"
|
||||
print "cmdline: --hosts=host1,host2,..."
|
||||
print "cmdline: --gateways=host1,host2,..."
|
||||
print "conftest.py: pytest_option_hosts=['host1','host2',]"
|
||||
print "environment: PYTEST_OPTION_HOSTS=host1,host2,host3"
|
||||
print
|
||||
|
|
|
@ -4,17 +4,17 @@ from py.__.test.dsession.masterslave import MasterNode
|
|||
from py.__.execnet.gwmanage import GatewayManager
|
||||
from py.__.test import event
|
||||
|
||||
def getconfighosts(config):
|
||||
def getconfiggwspecs(config):
|
||||
if config.option.numprocesses:
|
||||
hosts = ['popen'] * config.option.numprocesses
|
||||
gwspecs = ['popen'] * config.option.numprocesses
|
||||
else:
|
||||
hosts = config.option.hosts
|
||||
if not hosts:
|
||||
hosts = config.getvalue("hosts")
|
||||
gwspecs = config.option.gateways
|
||||
if not gwspecs:
|
||||
gwspecs = config.getvalue("gateways")
|
||||
else:
|
||||
hosts = hosts.split(",")
|
||||
assert hosts is not None
|
||||
return hosts
|
||||
gwspecs = gwspecs.split(",")
|
||||
assert gwspecs is not None
|
||||
return gwspecs
|
||||
|
||||
def getconfigroots(config):
|
||||
roots = config.option.rsyncdirs
|
||||
|
@ -34,7 +34,7 @@ class HostManager(object):
|
|||
def __init__(self, config, hosts=None):
|
||||
self.config = config
|
||||
if hosts is None:
|
||||
hosts = getconfighosts(self.config)
|
||||
hosts = getconfiggwspecs(self.config)
|
||||
self.roots = getconfigroots(config)
|
||||
self.gwmanager = GatewayManager(hosts)
|
||||
|
||||
|
|
|
@ -42,7 +42,7 @@ class TestAsyncFunctional:
|
|||
def test_fail():
|
||||
assert 0
|
||||
""")
|
||||
config = testdir.parseconfig('-d', p1, '--hosts=popen')
|
||||
config = testdir.parseconfig('-d', p1, '--gateways=popen')
|
||||
dsession = DSession(config)
|
||||
eq = EventQueue(config.bus)
|
||||
dsession.main([config.getfsnode(p1)])
|
||||
|
@ -65,7 +65,7 @@ class TestAsyncFunctional:
|
|||
p = subdir.join("test_one.py")
|
||||
p.write("def test_5(): assert not __file__.startswith(%r)" % str(p))
|
||||
result = testdir.runpytest("-d", "--rsyncdirs=%(subdir)s" % locals(),
|
||||
"--hosts=popen:%(dest)s" % locals(), p)
|
||||
"--gateways=popen:%(dest)s" % locals(), p)
|
||||
assert result.ret == 0
|
||||
result.stdout.fnmatch_lines([
|
||||
"*1 passed*"
|
||||
|
@ -85,7 +85,7 @@ class TestAsyncFunctional:
|
|||
import os
|
||||
assert os.nice(0) == 10
|
||||
""")
|
||||
evrec = testdir.inline_run('-d', p1, '--hosts=popen')
|
||||
evrec = testdir.inline_run('-d', p1, '--gateways=popen')
|
||||
ev = evrec.getreport('test_nice')
|
||||
assert ev.passed
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
"""
|
||||
|
||||
import py
|
||||
from py.__.test.dsession.hostmanage import HostManager, getconfighosts, getconfigroots
|
||||
from py.__.test.dsession.hostmanage import HostManager, getconfiggwspecs, getconfigroots
|
||||
from py.__.execnet.gwmanage import GatewaySpec as Host
|
||||
|
||||
from py.__.test import event
|
||||
|
@ -18,7 +18,7 @@ class TestHostManager:
|
|||
def gethostmanager(self, source, hosts, rsyncdirs=None):
|
||||
def opt(optname, l):
|
||||
return '%s=%s' % (optname, ",".join(map(str, l)))
|
||||
args = [opt('--hosts', hosts)]
|
||||
args = [opt('--gateways', hosts)]
|
||||
if rsyncdirs:
|
||||
args.append(opt('--rsyncdir', [source.join(x, abs=True) for x in rsyncdirs]))
|
||||
args.append(source)
|
||||
|
@ -148,14 +148,14 @@ class TestHostManager:
|
|||
assert 0
|
||||
|
||||
|
||||
def test_getconfighosts_numprocesses():
|
||||
def test_getconfiggwspecs_numprocesses():
|
||||
config = py.test.config._reparse(['-n3'])
|
||||
hosts = getconfighosts(config)
|
||||
hosts = getconfiggwspecs(config)
|
||||
assert len(hosts) == 3
|
||||
|
||||
def test_getconfighosts_disthosts():
|
||||
config = py.test.config._reparse(['--hosts=a,b,c'])
|
||||
hosts = getconfighosts(config)
|
||||
def test_getconfiggwspecs_disthosts():
|
||||
config = py.test.config._reparse(['--gateways=a,b,c'])
|
||||
hosts = getconfiggwspecs(config)
|
||||
assert len(hosts) == 3
|
||||
assert hosts == ['a', 'b', 'c']
|
||||
|
||||
|
|
|
@ -94,8 +94,8 @@ class DefaultPlugin:
|
|||
group.addoption('--rsyncdirs', dest="rsyncdirs", default=None, metavar="dir1,dir2,...",
|
||||
help="comma-separated list of directories to rsync. All those roots will be rsynced "
|
||||
"into a corresponding subdir on the remote sides. ")
|
||||
group.addoption('--hosts', dest="hosts", default=None, metavar="host1,host2,...",
|
||||
help="comma-separated list of host specs to send tests to.")
|
||||
group.addoption('--gateways', dest="gateways", default=None, metavar="spec1,spec2,...",
|
||||
help="comma-separated list of gateway specs, used by test distribution modes")
|
||||
group._addoption('--exec',
|
||||
action="store", dest="executable", default=None,
|
||||
help="python executable to run the tests with.")
|
||||
|
|
|
@ -265,7 +265,7 @@ class TestPyTest:
|
|||
py.test.skip("hello")
|
||||
""",
|
||||
)
|
||||
result = testdir.runpytest(p1, '-d', '--hosts=popen,popen')
|
||||
result = testdir.runpytest(p1, '-d', '--gateways=popen,popen')
|
||||
result.stdout.fnmatch_lines([
|
||||
"HOSTUP: popen*Python*",
|
||||
#"HOSTUP: localhost*Python*",
|
||||
|
@ -288,7 +288,7 @@ class TestPyTest:
|
|||
""",
|
||||
)
|
||||
testdir.makeconftest("""
|
||||
pytest_option_hosts='popen,popen,popen'
|
||||
pytest_option_gateways='popen,popen,popen'
|
||||
""")
|
||||
result = testdir.runpytest(p1, '-d')
|
||||
result.stdout.fnmatch_lines([
|
||||
|
@ -320,7 +320,7 @@ class TestPyTest:
|
|||
os.kill(os.getpid(), 15)
|
||||
"""
|
||||
)
|
||||
result = testdir.runpytest(p1, '-d', '--hosts=popen,popen,popen')
|
||||
result = testdir.runpytest(p1, '-d', '--gateways=popen,popen,popen')
|
||||
result.stdout.fnmatch_lines([
|
||||
"*popen*Python*",
|
||||
"*popen*Python*",
|
||||
|
|
Loading…
Reference in New Issue