[py-svn] r31498 - in py/branch/distributed/py/test/rsession: . testing
fijal at codespeak.net
fijal at codespeak.net
Tue Aug 22 18:53:17 CEST 2006
Author: fijal
Date: Tue Aug 22 18:53:15 2006
New Revision: 31498
Modified:
py/branch/distributed/py/test/rsession/master.py
py/branch/distributed/py/test/rsession/testing/test_dispatcher.py
Log:
(hpk, fijal) - Added slave setup code.
Modified: py/branch/distributed/py/test/rsession/master.py
==============================================================================
--- py/branch/distributed/py/test/rsession/master.py (original)
+++ py/branch/distributed/py/test/rsession/master.py Tue Aug 22 18:53:15 2006
@@ -1,6 +1,7 @@
"""
Node code for Master.
"""
+import py
from py.__.test.rsession.outcome import ReprOutcome
MAX_TASKS_PER_NODE = 5
@@ -42,6 +43,17 @@
event.clear()
# wait here
+def setup():
+ from py.__.test.rsession.slave import slave_main
+ slave_main(channel.receive, channel.send)
+
+def setup_slave(gateway, base_path = None):
+ if base_path is None:
+ base_path = str(py.path.local(py.__file__).dirpath().dirpath())
+ ch = gateway.remote_exec(py.code.Source(setup, "setup()"))
+ ch.send(base_path)
+ return ch
+
# master side:
# gw = SshGateway(sshhost)
# rsync -az --delete --exclude=.svn %(source)s %(sshhost)s:%(path)s
Modified: py/branch/distributed/py/test/rsession/testing/test_dispatcher.py
==============================================================================
--- py/branch/distributed/py/test/rsession/testing/test_dispatcher.py (original)
+++ py/branch/distributed/py/test/rsession/testing/test_dispatcher.py Tue Aug 22 18:53:15 2006
@@ -5,10 +5,13 @@
import time, threading
-from py.__.test.rsession.master import dispatch_loop
+import py
+from py.__.test.rsession.master import dispatch_loop, setup_slave
+from py.__.test.rsession.outcome import ReprOutcome
+from py.__.test.rsession.testing.test_slave import funcpass_spec
-#def sleeping_test():
-# time.sleep(0.3)
+def setup_module(mod):
+ mod.rootdir = py.path.local(py.__file__).dirpath().dirpath()
class DummyMasterNode(object):
def __init__(self):
@@ -34,3 +37,18 @@
itemgenerator = iter(range(100))
shouldstop = lambda : False
dispatch_loop(masternodes, itemgenerator, shouldstop, event)
+
+def test_slave_setup():
+ gw = py.execnet.PopenGateway()
+ channel = setup_slave(gw)
+ channel.send(funcpass_spec)
+ output = ReprOutcome(channel.receive())
+ assert output.passed
+ channel.send(None)
+ channel.waitclose(10)
+ gw.exit()
+
+#def test_dispatcher_real():
+# event = threading.Event()
+# gw1 = py.execnet.PopenGateway()
+# gw2 = py.execnet.PopenGateway()
More information about the pytest-commit
mailing list