Example #1
0
    def test_popens_rsync(self, config, mysetup, slavecontroller):
        source = mysetup.source
        hm = NodeManager(config, ["popen"] * 2)
        hm.setup_nodes(None)
        assert len(hm.group) == 2
        for gw in hm.group:

            class pseudoexec:
                args = []

                def __init__(self, *args):
                    self.args.extend(args)

                def waitclose(self):
                    pass

            gw.remote_exec = pseudoexec
        notifications = []
        for gw in hm.group:
            hm.rsync(gw,
                     source,
                     notify=lambda *args: notifications.append(args))
        assert not notifications
        hm.teardown_nodes()
        assert not len(hm.group)
        assert "sys.path.insert" in gw.remote_exec.args[0]
Example #2
0
 def test_rsync_popen_with_path(self, config, mysetup):
     source, dest = mysetup.source, mysetup.dest
     hm = NodeManager(config, ["popen//chdir=%s" %dest] * 1)
     hm.makegateways()
     source.ensure("dir1", "dir2", "hello")
     l = []
     hm.rsync(source, notify=lambda *args: l.append(args))
     assert len(l) == 1
     assert l[0] == ("rsyncrootready", hm.group['gw0'].spec, source)
     hm.teardown_nodes()
     dest = dest.join(source.basename)
     assert dest.join("dir1").check()
     assert dest.join("dir1", "dir2").check()
     assert dest.join("dir1", "dir2", 'hello').check()
Example #3
0
    def test_popen_makegateway_events(self, config, hookrecorder, _pytest):
        hm = NodeManager(config, ["popen"] * 2)
        hm.makegateways()
        call = hookrecorder.popcall("pytest_xdist_setupnodes")
        assert len(call.specs) == 2

        call = hookrecorder.popcall("pytest_xdist_newgateway")
        assert call.gateway.spec == execnet.XSpec("popen")
        assert call.gateway.id == "gw0"
        call = hookrecorder.popcall("pytest_xdist_newgateway")
        assert call.gateway.id == "gw1"
        assert len(hm.group) == 2
        hm.teardown_nodes()
        assert not len(hm.group)
Example #4
0
 def test_rsync_popen_with_path(self, config, mysetup, slavecontroller):
     source, dest = mysetup.source, mysetup.dest
     hm = NodeManager(config, ["popen//chdir=%s" % dest] * 1)
     hm.setup_nodes(None)
     source.ensure("dir1", "dir2", "hello")
     l = []
     for gw in hm.group:
         hm.rsync(gw, source, notify=lambda *args: l.append(args))
     assert len(l) == 1
     assert l[0] == ("rsyncrootready", hm.group['gw0'].spec, source)
     hm.teardown_nodes()
     dest = dest.join(source.basename)
     assert dest.join("dir1").check()
     assert dest.join("dir1", "dir2").check()
     assert dest.join("dir1", "dir2", 'hello').check()
Example #5
0
    def test_popen_makegateway_events(self, config, hookrecorder,
                                      slavecontroller):
        hm = NodeManager(config, ["popen"] * 2)
        hm.setup_nodes(None)
        call = hookrecorder.popcall("pytest_xdist_setupnodes")
        assert len(call.specs) == 2

        call = hookrecorder.popcall("pytest_xdist_newgateway")
        assert call.gateway.spec == execnet.XSpec("popen")
        assert call.gateway.id == "gw0"
        call = hookrecorder.popcall("pytest_xdist_newgateway")
        assert call.gateway.id == "gw1"
        assert len(hm.group) == 2
        hm.teardown_nodes()
        assert not len(hm.group)
Example #6
0
 def test_popen_rsync_subdir(self, testdir, mysetup, slavecontroller):
     source, dest = mysetup.source, mysetup.dest
     dir1 = mysetup.source.mkdir("dir1")
     dir2 = dir1.mkdir("dir2")
     dir2.ensure("hello")
     for rsyncroot in (dir1, source):
         dest.remove()
         nodemanager = NodeManager(testdir.parseconfig(
             "--tx", "popen//chdir=%s" % dest, "--rsyncdir", rsyncroot,
             source, ))
         nodemanager.setup_nodes(None)  # calls .rsync_roots()
         if rsyncroot == source:
             dest = dest.join("source")
         assert dest.join("dir1").check()
         assert dest.join("dir1", "dir2").check()
         assert dest.join("dir1", "dir2", 'hello').check()
         nodemanager.teardown_nodes()
Example #7
0
 def test_popen_rsync_subdir(self, testdir, mysetup, slavecontroller):
     source, dest = mysetup.source, mysetup.dest
     dir1 = mysetup.source.mkdir("dir1")
     dir2 = dir1.mkdir("dir2")
     dir2.ensure("hello")
     for rsyncroot in (dir1, source):
         dest.remove()
         nodemanager = NodeManager(testdir.parseconfig(
             "--tx", "popen//chdir=%s" % dest, "--rsyncdir", rsyncroot,
             source, ))
         nodemanager.setup_nodes(None)  # calls .rsync_roots()
         if rsyncroot == source:
             dest = dest.join("source")
         assert dest.join("dir1").check()
         assert dest.join("dir1", "dir2").check()
         assert dest.join("dir1", "dir2", 'hello').check()
         nodemanager.teardown_nodes()
Example #8
0
 def test_popens_rsync(self, config, mysetup):
     source = mysetup.source
     hm = NodeManager(config, ["popen"] * 2)
     hm.makegateways()
     assert len(hm.group) == 2
     for gw in hm.group:
         class pseudoexec:
             args = []
             def __init__(self, *args):
                 self.args.extend(args)
             def waitclose(self):
                 pass
         gw.remote_exec = pseudoexec
     l = []
     hm.rsync(source, notify=lambda *args: l.append(args))
     assert not l
     hm.teardown_nodes()
     assert not len(hm.group)
     assert "sys.path.insert" in gw.remote_exec.args[0]