def test_initgateway_localhost_relpath(self): host = HostInfo("localhost:somedir") host.initgateway() assert host.gw try: homedir = py.path.local._gethomedir() expected = homedir.join("somedir") assert host.gw_remotepath == str(expected) finally: host.gw.exit()
def test_slave_setup(self): py.test.skip("Doesn't work anymore") pkgname = self.pkgpath.basename host = HostInfo("localhost:%s" %(self.tmpdir,)) host.initgateway() channel = setup_slave(host, self.config) spec = self._gettrail(pkgname, "test_something.py", "funcpass") print "sending", spec channel.send(spec) output = ReprOutcome(channel.receive()) assert output.passed channel.send(42) channel.waitclose(10) host.gw.exit()
def test_hrsync_localhost_inplace(self): h1 = HostInfo("localhost") events = [] rsync = HostRSync(self.source) h1.initgateway() rsync.add_target_host(h1, reporter=events.append) assert events l = [x for x in events if isinstance(x, repevent.HostRSyncing)] assert len(l) == 1 ev = l[0] assert ev.host == h1 assert ev.root == ev.remotepath l = [x for x in events if isinstance(x, repevent.HostRSyncRootReady)] assert len(l) == 1 ev = l[0] assert ev.root == self.source assert ev.host == h1
def test_initgateway_ssh_and_remotepath(self): option = py.test.config.option if option.sshtarget is None: py.test.skip("no known ssh target, use -S to set one") host = HostInfo("%s" % (option.sshtarget, )) # this test should be careful to not write/rsync anything # as the remotepath is the default location # and may be used in the real world host.initgateway() assert host.gw assert host.gw_remotepath.endswith(host.relpath) channel = host.gw.remote_exec(""" import os homedir = os.environ['HOME'] relpath = channel.receive() path = os.path.join(homedir, relpath) channel.send(path) """) channel.send(host.relpath) res = channel.receive() assert res == host.gw_remotepath