[svn r63018] rename "--hosts" to "--gateways" to make naming more consistent with py.execnet

--HG--
branch : trunk
This commit is contained in:
hpk 2009-03-18 00:58:06 +01:00
parent d626a63934
commit b5b7f9b3a9
6 changed files with 25 additions and 25 deletions

View File

@ -63,7 +63,7 @@ class DSession(Session):
config.getvalue('hosts') config.getvalue('hosts')
except KeyError: except KeyError:
print "Please specify hosts for distribution of tests:" 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 "conftest.py: pytest_option_hosts=['host1','host2',]"
print "environment: PYTEST_OPTION_HOSTS=host1,host2,host3" print "environment: PYTEST_OPTION_HOSTS=host1,host2,host3"
print print

View File

@ -4,17 +4,17 @@ from py.__.test.dsession.masterslave import MasterNode
from py.__.execnet.gwmanage import GatewayManager from py.__.execnet.gwmanage import GatewayManager
from py.__.test import event from py.__.test import event
def getconfighosts(config): def getconfiggwspecs(config):
if config.option.numprocesses: if config.option.numprocesses:
hosts = ['popen'] * config.option.numprocesses gwspecs = ['popen'] * config.option.numprocesses
else: else:
hosts = config.option.hosts gwspecs = config.option.gateways
if not hosts: if not gwspecs:
hosts = config.getvalue("hosts") gwspecs = config.getvalue("gateways")
else: else:
hosts = hosts.split(",") gwspecs = gwspecs.split(",")
assert hosts is not None assert gwspecs is not None
return hosts return gwspecs
def getconfigroots(config): def getconfigroots(config):
roots = config.option.rsyncdirs roots = config.option.rsyncdirs
@ -34,7 +34,7 @@ class HostManager(object):
def __init__(self, config, hosts=None): def __init__(self, config, hosts=None):
self.config = config self.config = config
if hosts is None: if hosts is None:
hosts = getconfighosts(self.config) hosts = getconfiggwspecs(self.config)
self.roots = getconfigroots(config) self.roots = getconfigroots(config)
self.gwmanager = GatewayManager(hosts) self.gwmanager = GatewayManager(hosts)

View File

@ -42,7 +42,7 @@ class TestAsyncFunctional:
def test_fail(): def test_fail():
assert 0 assert 0
""") """)
config = testdir.parseconfig('-d', p1, '--hosts=popen') config = testdir.parseconfig('-d', p1, '--gateways=popen')
dsession = DSession(config) dsession = DSession(config)
eq = EventQueue(config.bus) eq = EventQueue(config.bus)
dsession.main([config.getfsnode(p1)]) dsession.main([config.getfsnode(p1)])
@ -65,7 +65,7 @@ class TestAsyncFunctional:
p = subdir.join("test_one.py") p = subdir.join("test_one.py")
p.write("def test_5(): assert not __file__.startswith(%r)" % str(p)) p.write("def test_5(): assert not __file__.startswith(%r)" % str(p))
result = testdir.runpytest("-d", "--rsyncdirs=%(subdir)s" % locals(), result = testdir.runpytest("-d", "--rsyncdirs=%(subdir)s" % locals(),
"--hosts=popen:%(dest)s" % locals(), p) "--gateways=popen:%(dest)s" % locals(), p)
assert result.ret == 0 assert result.ret == 0
result.stdout.fnmatch_lines([ result.stdout.fnmatch_lines([
"*1 passed*" "*1 passed*"
@ -85,7 +85,7 @@ class TestAsyncFunctional:
import os import os
assert os.nice(0) == 10 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') ev = evrec.getreport('test_nice')
assert ev.passed assert ev.passed

View File

@ -3,7 +3,7 @@
""" """
import py 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.__.execnet.gwmanage import GatewaySpec as Host
from py.__.test import event from py.__.test import event
@ -18,7 +18,7 @@ class TestHostManager:
def gethostmanager(self, source, hosts, rsyncdirs=None): def gethostmanager(self, source, hosts, rsyncdirs=None):
def opt(optname, l): def opt(optname, l):
return '%s=%s' % (optname, ",".join(map(str, l))) return '%s=%s' % (optname, ",".join(map(str, l)))
args = [opt('--hosts', hosts)] args = [opt('--gateways', hosts)]
if rsyncdirs: if rsyncdirs:
args.append(opt('--rsyncdir', [source.join(x, abs=True) for x in rsyncdirs])) args.append(opt('--rsyncdir', [source.join(x, abs=True) for x in rsyncdirs]))
args.append(source) args.append(source)
@ -148,14 +148,14 @@ class TestHostManager:
assert 0 assert 0
def test_getconfighosts_numprocesses(): def test_getconfiggwspecs_numprocesses():
config = py.test.config._reparse(['-n3']) config = py.test.config._reparse(['-n3'])
hosts = getconfighosts(config) hosts = getconfiggwspecs(config)
assert len(hosts) == 3 assert len(hosts) == 3
def test_getconfighosts_disthosts(): def test_getconfiggwspecs_disthosts():
config = py.test.config._reparse(['--hosts=a,b,c']) config = py.test.config._reparse(['--gateways=a,b,c'])
hosts = getconfighosts(config) hosts = getconfiggwspecs(config)
assert len(hosts) == 3 assert len(hosts) == 3
assert hosts == ['a', 'b', 'c'] assert hosts == ['a', 'b', 'c']

View File

@ -94,8 +94,8 @@ class DefaultPlugin:
group.addoption('--rsyncdirs', dest="rsyncdirs", default=None, metavar="dir1,dir2,...", group.addoption('--rsyncdirs', dest="rsyncdirs", default=None, metavar="dir1,dir2,...",
help="comma-separated list of directories to rsync. All those roots will be rsynced " help="comma-separated list of directories to rsync. All those roots will be rsynced "
"into a corresponding subdir on the remote sides. ") "into a corresponding subdir on the remote sides. ")
group.addoption('--hosts', dest="hosts", default=None, metavar="host1,host2,...", group.addoption('--gateways', dest="gateways", default=None, metavar="spec1,spec2,...",
help="comma-separated list of host specs to send tests to.") help="comma-separated list of gateway specs, used by test distribution modes")
group._addoption('--exec', group._addoption('--exec',
action="store", dest="executable", default=None, action="store", dest="executable", default=None,
help="python executable to run the tests with.") help="python executable to run the tests with.")

View File

@ -265,7 +265,7 @@ class TestPyTest:
py.test.skip("hello") py.test.skip("hello")
""", """,
) )
result = testdir.runpytest(p1, '-d', '--hosts=popen,popen') result = testdir.runpytest(p1, '-d', '--gateways=popen,popen')
result.stdout.fnmatch_lines([ result.stdout.fnmatch_lines([
"HOSTUP: popen*Python*", "HOSTUP: popen*Python*",
#"HOSTUP: localhost*Python*", #"HOSTUP: localhost*Python*",
@ -288,7 +288,7 @@ class TestPyTest:
""", """,
) )
testdir.makeconftest(""" testdir.makeconftest("""
pytest_option_hosts='popen,popen,popen' pytest_option_gateways='popen,popen,popen'
""") """)
result = testdir.runpytest(p1, '-d') result = testdir.runpytest(p1, '-d')
result.stdout.fnmatch_lines([ result.stdout.fnmatch_lines([
@ -320,7 +320,7 @@ class TestPyTest:
os.kill(os.getpid(), 15) 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([ result.stdout.fnmatch_lines([
"*popen*Python*", "*popen*Python*",
"*popen*Python*", "*popen*Python*",