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

hpk at codespeak.net hpk at codespeak.net
Wed Mar 18 00:58:07 CET 2009


Author: hpk
Date: Wed Mar 18 00:58:06 2009
New Revision: 63018

Modified:
   py/trunk/py/test/dsession/dsession.py
   py/trunk/py/test/dsession/hostmanage.py
   py/trunk/py/test/dsession/testing/test_functional_dsession.py
   py/trunk/py/test/dsession/testing/test_hostmanage.py
   py/trunk/py/test/plugin/pytest_default.py
   py/trunk/py/test/testing/acceptance_test.py
Log:
rename "--hosts" to "--gateways" to make naming more consistent with py.execnet


Modified: py/trunk/py/test/dsession/dsession.py
==============================================================================
--- py/trunk/py/test/dsession/dsession.py	(original)
+++ py/trunk/py/test/dsession/dsession.py	Wed Mar 18 00:58:06 2009
@@ -63,7 +63,7 @@
             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 

Modified: py/trunk/py/test/dsession/hostmanage.py
==============================================================================
--- py/trunk/py/test/dsession/hostmanage.py	(original)
+++ py/trunk/py/test/dsession/hostmanage.py	Wed Mar 18 00:58:06 2009
@@ -4,17 +4,17 @@
 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 @@
     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)
 

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	Wed Mar 18 00:58:06 2009
@@ -42,7 +42,7 @@
             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 @@
         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 @@
                 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
 

Modified: py/trunk/py/test/dsession/testing/test_hostmanage.py
==============================================================================
--- py/trunk/py/test/dsession/testing/test_hostmanage.py	(original)
+++ py/trunk/py/test/dsession/testing/test_hostmanage.py	Wed Mar 18 00:58:06 2009
@@ -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 @@
     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 @@
         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']
 

Modified: py/trunk/py/test/plugin/pytest_default.py
==============================================================================
--- py/trunk/py/test/plugin/pytest_default.py	(original)
+++ py/trunk/py/test/plugin/pytest_default.py	Wed Mar 18 00:58:06 2009
@@ -94,8 +94,8 @@
         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.")

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	Wed Mar 18 00:58:06 2009
@@ -265,7 +265,7 @@
                     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 @@
             """, 
         )
         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 @@
                     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*",



More information about the pytest-commit mailing list