[py-svn] r63151 - in py/trunk/py/test: dsession dsession/testing testing

hpk at codespeak.net hpk at codespeak.net
Fri Mar 20 18:58:38 CET 2009


Author: hpk
Date: Fri Mar 20 18:58:36 2009
New Revision: 63151

Modified:
   py/trunk/py/test/dsession/dsession.py
   py/trunk/py/test/dsession/testing/test_dsession.py
   py/trunk/py/test/dsession/testing/test_functional_dsession.py
   py/trunk/py/test/dsession/testing/test_masterslave.py
   py/trunk/py/test/testing/acceptance_test.py
Log:
fix various bits, many tests pass modulo dsession host/node handling 


Modified: py/trunk/py/test/dsession/dsession.py
==============================================================================
--- py/trunk/py/test/dsession/dsession.py	(original)
+++ py/trunk/py/test/dsession/dsession.py	Fri Mar 20 18:58:36 2009
@@ -86,12 +86,12 @@
         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 at somehost --tx popen//python=python2.5"
+            print "conftest.py: pytest_option_tx=['ssh=user at 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):

Modified: py/trunk/py/test/dsession/testing/test_dsession.py
==============================================================================
--- py/trunk/py/test/dsession/testing/test_dsession.py	(original)
+++ py/trunk/py/test/dsession/testing/test_dsession.py	Fri Mar 20 18:58:36 2009
@@ -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 @@
         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 @@
         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 @@
     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)

Modified: py/trunk/py/test/dsession/testing/test_functional_dsession.py
==============================================================================
--- py/trunk/py/test/dsession/testing/test_functional_dsession.py	(original)
+++ py/trunk/py/test/dsession/testing/test_functional_dsession.py	Fri Mar 20 18:58:36 2009
@@ -42,7 +42,7 @@
             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 @@
         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 @@
         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 @@
                 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
 

Modified: py/trunk/py/test/dsession/testing/test_masterslave.py
==============================================================================
--- py/trunk/py/test/dsession/testing/test_masterslave.py	(original)
+++ py/trunk/py/test/dsession/testing/test_masterslave.py	Fri Mar 20 18:58:36 2009
@@ -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 @@
             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 

Modified: py/trunk/py/test/testing/acceptance_test.py
==============================================================================
--- py/trunk/py/test/testing/acceptance_test.py	(original)
+++ py/trunk/py/test/testing/acceptance_test.py	Fri Mar 20 18:58:36 2009
@@ -265,7 +265,7 @@
                     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 @@
             """, 
         )
         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 @@
                     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 @@
                 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*", 



More information about the pytest-commit mailing list