From 10fb32ad373b486d82e5119b55afc1ec43dc30b2 Mon Sep 17 00:00:00 2001 From: hpk Date: Fri, 20 Mar 2009 18:58:36 +0100 Subject: [PATCH] [svn r63151] fix various bits, many tests pass modulo dsession host/node handling --HG-- branch : trunk --- py/test/dsession/dsession.py | 10 +++++----- py/test/dsession/testing/test_dsession.py | 9 ++++----- py/test/dsession/testing/test_functional_dsession.py | 8 ++++---- py/test/dsession/testing/test_masterslave.py | 5 ++--- py/test/testing/acceptance_test.py | 11 +++++++---- 5 files changed, 22 insertions(+), 21 deletions(-) diff --git a/py/test/dsession/dsession.py b/py/test/dsession/dsession.py index 7cab45662..95afa78aa 100644 --- a/py/test/dsession/dsession.py +++ b/py/test/dsession/dsession.py @@ -86,12 +86,12 @@ class DSession(Session): try: config.getvalue('hosts') except KeyError: - print "Please specify hosts for distribution of tests:" - print "cmdline: --gateways=host1,host2,..." - print "conftest.py: pytest_option_hosts=['host1','host2',]" - print "environment: PYTEST_OPTION_HOSTS=host1,host2,host3" + print "Please specify test environments for distribution of tests:" + print "py.test --tx ssh=user@somehost --tx popen//python=python2.5" + print "conftest.py: pytest_option_tx=['ssh=user@somehost','popen']" + print "environment: PYTEST_OPTION_TX=ssh=@somehost,popen" print - print "see also: http://codespeak.net/py/current/doc/test.html#automated-distributed-testing" + #print "see also: http://codespeak.net/py/current/doc/test.html#automated-distributed-testing" raise SystemExit def main(self, colitems=None): diff --git a/py/test/dsession/testing/test_dsession.py b/py/test/dsession/testing/test_dsession.py index dc4fe647e..8c37e3402 100644 --- a/py/test/dsession/testing/test_dsession.py +++ b/py/test/dsession/testing/test_dsession.py @@ -1,6 +1,5 @@ from py.__.test.dsession.dsession import DSession from py.__.test.dsession.masterslave import maketestnodeready -from py.__.execnet.gwmanage import GatewaySpec from py.__.test.runner import basic_collect_report from py.__.test import event from py.__.test import outcome @@ -38,7 +37,7 @@ class TestDSession: item = testdir.getitem("def test_func(): pass") rep = run(item) session = DSession(item.config) - host = GatewaySpec("localhost") + host = py.execnet.XSpec("popen") host.node = MockNode() assert not session.host2pending session.addhost(host) @@ -54,7 +53,7 @@ class TestDSession: item = testdir.getitem("def test_func(): pass") rep = run(item) session = DSession(item.config) - host = GatewaySpec("localhost") + host = py.execnet.XSpec("popen") host.node = MockNode() session.addhost(host) session.senditems([item]) @@ -79,9 +78,9 @@ class TestDSession: def test_triggertesting_item(self, testdir): item = testdir.getitem("def test_func(): pass") session = DSession(item.config) - host1 = GatewaySpec("localhost") + host1 = py.execnet.XSpec("popen") host1.node = MockNode() - host2 = GatewaySpec("localhost") + host2 = py.execnet.XSpec("popen") host2.node = MockNode() session.addhost(host1) session.addhost(host2) diff --git a/py/test/dsession/testing/test_functional_dsession.py b/py/test/dsession/testing/test_functional_dsession.py index f24001543..8e54f6f99 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, '--gateways=popen') + config = testdir.parseconfig('-d', p1, '--tx=popen') dsession = DSession(config) eq = EventQueue(config.bus) dsession.main([config.getfsnode(p1)]) @@ -54,7 +54,7 @@ class TestAsyncFunctional: assert ev.failed # see that the host is really down ev, = eq.geteventargs("testnodedown") - assert ev.host.address == "popen" + assert ev.host.popen ev, = eq.geteventargs("testrunfinish") def test_distribution_rsyncdirs_example(self, testdir): @@ -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(), - "--gateways=popen::%(dest)s" % locals(), p) + "--tx=popen//chdir=%(dest)s" % locals(), p) assert result.ret == 0 result.stdout.fnmatch_lines([ "*1* instantiated gateway *popen*", @@ -88,7 +88,7 @@ class TestAsyncFunctional: import os assert os.nice(0) == 10 """) - evrec = testdir.inline_run('-d', p1, '--gateways=popen') + evrec = testdir.inline_run('-d', p1, '--tx=popen') ev = evrec.getreport('test_nice') assert ev.passed diff --git a/py/test/dsession/testing/test_masterslave.py b/py/test/dsession/testing/test_masterslave.py index 03fb650b9..167fa74ff 100644 --- a/py/test/dsession/testing/test_masterslave.py +++ b/py/test/dsession/testing/test_masterslave.py @@ -1,7 +1,6 @@ import py from py.__.test.dsession.masterslave import MasterNode -from py.__.execnet.gwmanage import GatewaySpec class EventQueue: def __init__(self, bus, queue=None): @@ -43,8 +42,8 @@ class MySetup: config = py.test.config._reparse([]) self.config = config self.queue = py.std.Queue.Queue() - self.host = GatewaySpec("popen") - self.gateway = self.host.makegateway() + self.host = py.execnet.XSpec("popen") + self.gateway = py.execnet.makegateway(self.host) self.node = MasterNode(self.host, self.gateway, self.config, putevent=self.queue.put) assert not self.node.channel.isclosed() return self.node diff --git a/py/test/testing/acceptance_test.py b/py/test/testing/acceptance_test.py index 0177e8be9..81cea934c 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', '--gateways=popen,popen') + result = testdir.runpytest(p1, '-d', '--tx popen --tx popen') result.stdout.fnmatch_lines([ "HOSTUP: popen*Python*", #"HOSTUP: localhost*Python*", @@ -288,7 +288,7 @@ class TestPyTest: """, ) testdir.makeconftest(""" - pytest_option_gateways='popen,popen,popen' + pytest_option_tx = 'popen popen popen'.split() """) 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', '--gateways=popen,popen,popen') + result = testdir.runpytest(p1, '-d', '-n 3') result.stdout.fnmatch_lines([ "*popen*Python*", "*popen*Python*", @@ -434,7 +434,10 @@ class TestInteractive: print sys.version_info[:2] assert 0 """) - result = testdir.runpytest("--dist-each", "--gateways=popen-python2.5,popen-python2.4") + result = testdir.runpytest("--dist-each", + "--tx=popen//python2.4", + "--tx=popen//python2.5", + ) assert result.ret == 1 result.stdout.fnmatch_lines([ "*popen-python2.5*FAIL*",