[svn r37909] a much much much larger refactoring than i originally

intended at this point:

* HostManager and HostRSync are now acting
  more locally, also easier to test.

* HostInfo deals with setting up gateways now

* HostManager, HostRSync and HostInfo are
  all tested now in test_hostmanage.py
  (and do not involve a full startup of RSessions)

* for rsyncing, the original directory structure
  (relative to config.topdir) is preserved on the
  other side, this makes "dist_rsync_roots" relatively
  clean now (but it doesn't pick up things on the fly,
  only initialises at the beginning)

* added lots of tests

* removed more occurences of pkgdir

* streamlined and simplified some tests

* removed lots of tests that do not appear to test
  specifically enough (and caused trouble for
  the refactoring)

* removed lots of (but not all, i guess) test-specific
  functionality in hostmanage.py and a bit in rsession.py

* removed HostOptions() in favour of rather directly
  accessing config values

--HG--
branch : trunk
This commit is contained in:
hpk
2007-02-04 15:05:01 +01:00
parent f2b38db33a
commit 4791dd6501
10 changed files with 342 additions and 433 deletions
+1 -53
View File
@@ -11,6 +11,7 @@ if sys.platform == 'win32':
py.test.skip("rsession is unsupported on Windows.")
def setup_module(module):
module.tmpdir = py.test.ensuretemp(module.__name__)
module.rootdir = py.path.local(py.__file__).dirpath().dirpath()
module.rootcol = py.test.collect.Directory(rootdir)
@@ -107,64 +108,11 @@ def test_slave_run_failing_wrapped():
assert not outcome.setupfailure
assert outcome.excinfo
def test_slave_main_simple():
res = []
failitem = rootcol._getitembynames(funcfail_spec)
passitem = rootcol._getitembynames(funcpass_spec)
q = [None,
passitem._get_collector_trail(),
failitem._get_collector_trail()
]
config = py.test.config._reparse([])
pidinfo = PidInfo()
slave_main(q.pop, res.append, str(rootdir), config, pidinfo)
assert len(res) == 2
res_repr = [ReprOutcome(r) for r in res]
assert not res_repr[0].passed and res_repr[1].passed
def test_slave_run_different_stuff():
node = gettestnode()
node.run(rootcol._getitembynames("py doc log.txt".split()).
_get_collector_trail())
def test_slave_setup_exit():
tmp = py.test.ensuretemp("slaveexit")
tmp.ensure("__init__.py")
q = py.std.Queue.Queue()
config = py.test.config._reparse([tmp])
class C:
res = []
def __init__(self):
self.q = [str(tmp),
config.make_repr(conftestnames=['dist_nicelevel']),
funchang_spec,
42,
funcpass_spec]
self.q.reverse()
def receive(self):
return self.q.pop()
def setcallback(self, callback):
import thread
def f():
while 1:
callback(self.q.pop())
f()
#thread.start_new_thread(f, ())
def close(self):
pass
send = res.append
try:
exec py.code.Source(setup, "setup()").compile() in {'channel':C()}
except SystemExit:
pass
else:
py.test.fail("Did not exit")
def test_pidinfo():
if not hasattr(os, 'fork') or not hasattr(os, 'waitpid'):
py.test.skip("Platform does not support fork")