Ejemplo n.º 1
0
 def test_remote_counting(self):
     from distributed import socklayer
     from py.__.green.greensock2 import allof
     from py.__.green.greenexecnet import PopenGateway
     gws = [PopenGateway() for i in range(3)]
     rps = [socklayer.spawn_remote_side(self.remote_side_code, gw)
            for gw in gws]
     counters = [rp.get_remote("count") for rp in rps]
     assert allof(*counters) == (11, 11, 11)
Ejemplo n.º 2
0
def test_two_interpreters():
    i = Interpreter("python", timeout=3)
    i2 = Interpreter("python", timeout=3)
    while not i.interact().endswith(">>> "):
        pass
    while not i2.interact().endswith(">>> "):
        pass

    def f():
        return i.interact("import time;time.sleep(1)\n")
    def g():
        return i2.interact("a\n")

    one, two = allof(g, f)
    assert two.startswith(">>")
    assert one.startswith("Traceback")