From b5b7f9b3a978e18f94015a14c67a47bb598d83d2 Mon Sep 17 00:00:00 2001 From: hpk Date: Wed, 18 Mar 2009 00:58:06 +0100 Subject: [PATCH] [svn r63018] rename "--hosts" to "--gateways" to make naming more consistent with py.execnet --HG-- branch : trunk --- py/test/dsession/dsession.py | 2 +- py/test/dsession/hostmanage.py | 18 +++++++++--------- .../testing/test_functional_dsession.py | 6 +++--- py/test/dsession/testing/test_hostmanage.py | 14 +++++++------- py/test/plugin/pytest_default.py | 4 ++-- py/test/testing/acceptance_test.py | 6 +++--- 6 files changed, 25 insertions(+), 25 deletions(-) diff --git a/py/test/dsession/dsession.py b/py/test/dsession/dsession.py index 54a38c8e7..0fd4ff9b9 100644 --- a/py/test/dsession/dsession.py +++ b/py/test/dsession/dsession.py @@ -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 diff --git a/py/test/dsession/hostmanage.py b/py/test/dsession/hostmanage.py index db5124e0a..4f50d96f2 100644 --- a/py/test/dsession/hostmanage.py +++ b/py/test/dsession/hostmanage.py @@ -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) diff --git a/py/test/dsession/testing/test_functional_dsession.py b/py/test/dsession/testing/test_functional_dsession.py index a95d9085d..cc78173f0 100644 --- a/py/test/dsession/testing/test_functional_dsession.py +++ b/py/test/dsession/testing/test_functional_dsession.py @@ -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 diff --git a/py/test/dsession/testing/test_hostmanage.py b/py/test/dsession/testing/test_hostmanage.py index 7b5dcd2a8..85678f2a0 100644 --- a/py/test/dsession/testing/test_hostmanage.py +++ b/py/test/dsession/testing/test_hostmanage.py @@ -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'] diff --git a/py/test/plugin/pytest_default.py b/py/test/plugin/pytest_default.py index db04f83f6..ab9d3e268 100644 --- a/py/test/plugin/pytest_default.py +++ b/py/test/plugin/pytest_default.py @@ -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.") diff --git a/py/test/testing/acceptance_test.py b/py/test/testing/acceptance_test.py index a8042168b..9541cd1f2 100644 --- a/py/test/testing/acceptance_test.py +++ b/py/test/testing/acceptance_test.py @@ -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*",