[py-svn] r56675 - in py/branch/event/py/test2: rep/testing rsession rsession/testing
hpk at codespeak.net
hpk at codespeak.net
Sat Jul 19 16:42:35 CEST 2008
Author: hpk
Date: Sat Jul 19 16:42:33 2008
New Revision: 56675
Modified:
py/branch/event/py/test2/rep/testing/test_reporter.py
py/branch/event/py/test2/rep/testing/test_rest.py
py/branch/event/py/test2/rsession/hostmanage.py
py/branch/event/py/test2/rsession/testing/test_hostmanage.py
py/branch/event/py/test2/rsession/testing/test_masterslave.py
py/branch/event/py/test2/rsession/testing/test_rsession.py
Log:
some internal renaming, HostInfo -> Host
Modified: py/branch/event/py/test2/rep/testing/test_reporter.py
==============================================================================
--- py/branch/event/py/test2/rep/testing/test_reporter.py (original)
+++ py/branch/event/py/test2/rep/testing/test_reporter.py Sat Jul 19 16:42:33 2008
@@ -24,7 +24,7 @@
from py.__.test2.reporter import RemoteReporter, LocalReporter, choose_reporter
from py.__.test2 import repevent
from py.__.test2.outcome import ReprOutcome, SerializableOutcome
-from py.__.test2.rsession.hostmanage import HostInfo
+from py.__.test2.rsession.hostmanage import Host
from py.__.test2.box import Box
from py.__.test2.rsession.testing.basetest import BasicRsessionTest
import sys
@@ -189,7 +189,7 @@
tmpdir.ensure("__init__.py")
cap = py.io.StdCaptureFD()
config = py.test2.config._reparse([str(tmpdir)])
- hosts = [HostInfo(i) for i in ["host1", "host2", "host3"]]
+ hosts = [Host(i) for i in ["host1", "host2", "host3"]]
for host in hosts:
host.gw_remotepath = ''
r = self.reporter(config, hosts)
@@ -240,7 +240,7 @@
reporter = RemoteReporter
def get_hosts(self):
- return [HostInfo("host")]
+ return [Host("host")]
def test_still_to_go(self):
self._test_still_to_go()
Modified: py/branch/event/py/test2/rep/testing/test_rest.py
==============================================================================
--- py/branch/event/py/test2/rep/testing/test_rest.py (original)
+++ py/branch/event/py/test2/rep/testing/test_rest.py Sat Jul 19 16:42:33 2008
@@ -11,7 +11,7 @@
from py.__.test2 import repevent
from py.__.test2.rsession.rest import RestReporter, NoLinkWriter
from py.__.rest.rst import *
-from py.__.test2.rsession.hostmanage import HostInfo
+from py.__.test2.rsession.hostmanage import Host
from py.__.test2.outcome import SerializableOutcome
class Container(object):
@@ -29,7 +29,7 @@
config = py.test2.config._reparse(["some_sub"])
config.option.verbose = False
self.config = config
- hosts = [HostInfo('localhost')]
+ hosts = [Host('localhost')]
method.im_func.func_globals['ch'] = DummyChannel(hosts[0])
method.im_func.func_globals['reporter'] = r = RestReporter(config,
hosts)
@@ -55,14 +55,14 @@
'localhost\n\n')
def test_report_HostRSyncing(self):
- event = repevent.HostRSyncing(HostInfo('localhost:/foo/bar'), "a",
+ event = repevent.HostRSyncing(Host('localhost:/foo/bar'), "a",
"b", False)
reporter.report(event)
assert stdout.getvalue() == ('::\n\n localhost: RSYNC ==> '
'/foo/bar\n\n')
def test_report_HostRSyncRootReady(self):
- h = HostInfo('localhost')
+ h = Host('localhost')
reporter.hosts_to_rsync = 1
reporter.report(repevent.HostGatewayReady(h, ["a"]))
event = repevent.HostRSyncRootReady(h, "a")
@@ -70,8 +70,8 @@
assert stdout.getvalue() == '::\n\n localhost: READY\n\n'
def test_report_TestStarted(self):
- event = repevent.TestStarted([HostInfo('localhost'),
- HostInfo('foo.com')],
+ event = repevent.TestStarted([Host('localhost'),
+ Host('foo.com')],
"aa", ["a", "b"])
reporter.report(event)
assert stdout.getvalue() == """\
@@ -336,7 +336,7 @@
reporter = RestReporter
def get_hosts(self):
- return [HostInfo('localhost')]
+ return [Host('localhost')]
def test_failed_to_load(self):
py.test.skip("Not implemented")
Modified: py/branch/event/py/test2/rsession/hostmanage.py
==============================================================================
--- py/branch/event/py/test2/rsession/hostmanage.py (original)
+++ py/branch/event/py/test2/rsession/hostmanage.py Sat Jul 19 16:42:33 2008
@@ -3,7 +3,7 @@
from py.__.test2.rsession.master import MasterNode
from py.__.test2 import repevent
-class HostInfo(object):
+class Host(object):
""" Host location representation for distributed testing. """
_hostname2list = {}
@@ -53,7 +53,7 @@
self.gw_remotepath = channel.receive()
def __str__(self):
- return "<HostInfo %s:%s>" % (self.hostname, self.relpath)
+ return "<Host %s:%s>" % (self.hostname, self.relpath)
__repr__ = __str__
def __hash__(self):
@@ -126,7 +126,7 @@
self.roots = roots
if hosts is None:
hosts = self.config.getvalue("dist_hosts")
- hosts = [HostInfo(x, addrel) for x in hosts]
+ hosts = [Host(x, addrel) for x in hosts]
self.hosts = hosts
def prepare_gateways(self):
Modified: py/branch/event/py/test2/rsession/testing/test_hostmanage.py
==============================================================================
--- py/branch/event/py/test2/rsession/testing/test_hostmanage.py (original)
+++ py/branch/event/py/test2/rsession/testing/test_hostmanage.py Sat Jul 19 16:42:33 2008
@@ -4,49 +4,55 @@
import py
from basetest import DirSetup
-from py.__.test2.rsession.hostmanage import HostRSync, HostInfo, HostManager
+from py.__.test2.rsession.hostmanage import HostRSync, Host, HostManager
from py.__.test2.rsession.hostmanage import sethomedir, gethomedir, getpath_relto_home
from py.__.test2 import repevent
-class TestHostInfo(DirSetup):
+class TestHost(DirSetup):
def _gethostinfo(self, relpath=""):
exampledir = self.tmpdir.join("gethostinfo")
if relpath:
exampledir = exampledir.join(relpath)
assert not exampledir.check()
- hostinfo = HostInfo("localhost:%s" % exampledir)
+ hostinfo = Host("localhost:%s" % exampledir)
return hostinfo
def test_defaultpath(self):
- x = HostInfo("localhost:")
+ x = Host("localhost:")
assert x.hostname == "localhost"
assert not x.relpath
def test_addrel(self):
- host = HostInfo("localhost:", addrel="whatever")
+ host = Host("localhost:", addrel="whatever")
assert host.inplacelocal
assert not host.relpath
- host = HostInfo("localhost:/tmp", addrel="base")
+ host = Host("localhost:/tmp", addrel="base")
assert host.relpath == "/tmp/base"
- host = HostInfo("localhost:tmp", addrel="base2")
+ host = Host("localhost:tmp", addrel="base2")
assert host.relpath == "tmp/base2"
def test_path(self):
- x = HostInfo("localhost:/tmp")
+ x = Host("localhost:/tmp")
assert x.relpath == "/tmp"
assert x.hostname == "localhost"
assert not x.inplacelocal
+ def test_equality(self):
+ x = Host("localhost:")
+ y = Host("localhost:")
+ assert x != y
+ assert not (x == y)
+
def test_hostid(self):
- x = HostInfo("localhost:")
- y = HostInfo("localhost:")
+ x = Host("localhost:")
+ y = Host("localhost:")
assert x.hostid != y.hostid
- x = HostInfo("localhost:/tmp")
- y = HostInfo("localhost:")
+ x = Host("localhost:/tmp")
+ y = Host("localhost:")
assert x.hostid != y.hostid
def test_non_existing_hosts(self):
- host = HostInfo("alskdjalsdkjasldkajlsd")
+ host = Host("alskdjalsdkjasldkajlsd")
py.test2.raises((py.process.cmdexec.Error, IOError, EOFError),
host.initgateway)
@@ -68,7 +74,7 @@
old.chdir()
def test_initgateway_localhost_relpath(self):
- host = HostInfo("localhost:somedir")
+ host = Host("localhost:somedir")
host.initgateway()
assert host.gw
try:
@@ -82,7 +88,7 @@
option = py.test2.config.option
if getattr(option, 'sshtarget', None) is None:
py.test.skip("no known ssh target, use -S to set one")
- host = HostInfo("%s" % (option.sshtarget, ))
+ host = Host("%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
@@ -102,7 +108,7 @@
class TestSyncing(DirSetup):
def _gethostinfo(self):
- hostinfo = HostInfo("localhost:%s" % self.dest)
+ hostinfo = Host("localhost:%s" % self.dest)
return hostinfo
def test_hrsync_filter(self):
@@ -120,7 +126,7 @@
assert 'somedir' in basenames
def test_hrsync_localhost_inplace(self):
- h1 = HostInfo("localhost")
+ h1 = Host("localhost")
events = []
rsync = HostRSync(self.source)
h1.initgateway()
@@ -216,7 +222,7 @@
"""))
config = py.test2.config._reparse([self.source])
hm = HostManager(config,
- hosts=[HostInfo("localhost:" + str(self.dest))])
+ hosts=[Host("localhost:" + str(self.dest))])
hm.init_rsync()
assert self.dest.join("dir2").check()
assert not self.dest.join("dir1").check()
@@ -232,7 +238,7 @@
"""))
config = py.test2.config._reparse([self.source])
hm = HostManager(config,
- hosts=[HostInfo("localhost:" + str(self.dest))])
+ hosts=[Host("localhost:" + str(self.dest))])
hm.init_rsync()
assert self.dest.join("dir1").check()
assert not self.dest.join("dir1", "dir2").check()
@@ -240,7 +246,7 @@
assert not self.dest.join("dir6").check()
def test_hostmanage_optimise_localhost(self):
- hosts = [HostInfo("localhost") for i in range(3)]
+ hosts = [Host("localhost") for i in range(3)]
config = py.test2.config._reparse([self.source])
hm = HostManager(config, hosts=hosts)
hm.init_rsync()
@@ -254,8 +260,8 @@
option = py.test2.config.option
if option.sshtarget is None:
py.test.skip("no known ssh target, use -S to set one")
- host1 = HostInfo("%s" % (option.sshtarget, ))
- host2 = HostInfo("%s" % (option.sshtarget, ))
+ host1 = Host("%s" % (option.sshtarget, ))
+ host2 = Host("%s" % (option.sshtarget, ))
hm = HostManager(config, hosts=[host1, host2])
events = []
hm.init_rsync(events.append)
Modified: py/branch/event/py/test2/rsession/testing/test_masterslave.py
==============================================================================
--- py/branch/event/py/test2/rsession/testing/test_masterslave.py (original)
+++ py/branch/event/py/test2/rsession/testing/test_masterslave.py Sat Jul 19 16:42:33 2008
@@ -1,7 +1,7 @@
import py
from py.__.test2.rsession.master import MasterNode
-from py.__.test2.rsession.hostmanage import HostInfo
+from py.__.test2.rsession.hostmanage import Host
from basetest import BasicRsessionTest
from py.__.test2 import repevent
@@ -16,7 +16,7 @@
return queue
def test_node_down(self):
- host = HostInfo("localhost")
+ host = Host("localhost")
host.initgateway()
node = MasterNode(host, self.config)
assert not node.channel.isclosed()
@@ -27,7 +27,7 @@
assert event.host == host
def test_send_one(self):
- host = HostInfo("localhost")
+ host = Host("localhost")
host.initgateway()
node = MasterNode(host, self.config)
assert not node.channel.isclosed()
@@ -39,7 +39,7 @@
assert not node.pending
def test_send_multiple(self):
- host = HostInfo("localhost")
+ host = Host("localhost")
host.initgateway()
node = MasterNode(host, self.config)
assert not node.channel.isclosed()
Modified: py/branch/event/py/test2/rsession/testing/test_rsession.py
==============================================================================
--- py/branch/event/py/test2/rsession/testing/test_rsession.py (original)
+++ py/branch/event/py/test2/rsession/testing/test_rsession.py Sat Jul 19 16:42:33 2008
@@ -5,7 +5,7 @@
import py
from py.__.test2 import repevent
from py.__.test2.rsession.rsession import RSession
-from py.__.test2.rsession.hostmanage import HostManager, HostInfo
+from py.__.test2.rsession.hostmanage import HostManager, Host
from basetest import BasicRsessionTest, DirSetup
from py.__.test2.testing import suptest
@@ -86,7 +86,7 @@
assert len([x for x in testevents if x.skipped]) == 0
def test_setup_teardown_run_ssh(self):
- hosts = [HostInfo('localhost:%s' % self.dest)]
+ hosts = [Host('localhost:%s' % self.dest)]
queue = py.std.Queue.Queue()
self.config.bus.subscribe(queue.put)
@@ -123,7 +123,7 @@
def test_nice_level(self):
""" Tests if nice level behaviour is ok
"""
- hosts = [HostInfo('localhost:%s' % self.dest)]
+ hosts = [Host('localhost:%s' % self.dest)]
tmpdir = self.source
tmpdir.ensure("__init__.py")
tmpdir.ensure("conftest.py").write(py.code.Source("""
More information about the pytest-commit
mailing list