[py-svn] r38391 - in py/trunk/py/test/rsession: . testing
hpk at codespeak.net
hpk at codespeak.net
Sat Feb 10 16:05:34 CET 2007
Author: hpk
Date: Sat Feb 10 16:05:32 2007
New Revision: 38391
Modified:
py/trunk/py/test/rsession/hostmanage.py
py/trunk/py/test/rsession/testing/test_hostmanage.py
Log:
check more exactly if we are working
from a default rsync_root (checking
for rsync_root == topdir is not safe
as the topdir may be explicitely contained
in the rsync_root list)
Modified: py/trunk/py/test/rsession/hostmanage.py
==============================================================================
--- py/trunk/py/test/rsession/hostmanage.py (original)
+++ py/trunk/py/test/rsession/hostmanage.py Sat Feb 10 16:05:32 2007
@@ -124,6 +124,7 @@
if roots is None:
roots = [self.config.topdir]
addrel = self.config.topdir.basename
+ self._addrel = addrel
self.roots = roots
if hosts is None:
hosts = self.config.getvalue("dist_hosts")
@@ -144,7 +145,7 @@
for root in self.roots:
rsync = HostRSync(root, ignores=ignores,
verbose=self.config.option.verbose)
- if root == self.config.topdir:
+ if self._addrel:
destrelpath = ""
else:
destrelpath = root.basename
Modified: py/trunk/py/test/rsession/testing/test_hostmanage.py
==============================================================================
--- py/trunk/py/test/rsession/testing/test_hostmanage.py (original)
+++ py/trunk/py/test/rsession/testing/test_hostmanage.py Sat Feb 10 16:05:32 2007
@@ -169,10 +169,11 @@
assert not res2
class TestHostManager(DirSetup):
- def gethostmanager(self, dist_hosts):
- self.source.join("conftest.py").write(py.code.Source("""
- dist_hosts = %r
- """ % (dist_hosts,)))
+ def gethostmanager(self, dist_hosts, dist_rsync_roots=None):
+ l = ["dist_hosts = %r" % dist_hosts]
+ if dist_rsync_roots:
+ l.append("dist_rsync_roots = %r" % dist_rsync_roots)
+ self.source.join("conftest.py").write("\n".join(l))
config = py.test.config._reparse([self.source])
assert config.topdir == self.source
hm = HostManager(config)
@@ -197,7 +198,21 @@
assert dest.join("dir1", "dir2").check()
assert dest.join("dir1", "dir2", 'hello').check()
- def test_hostmanager_init_rsync_rsync_roots(self):
+ def test_hostmanager_init_rsync_topdir_explicit(self):
+ dir2 = self.source.ensure("dir1", "dir2", dir=1)
+ dir2.ensure("hello")
+ hm = self.gethostmanager(
+ dist_hosts = ["localhost:%s" % self.dest]
+ dist_rsync_roots = [self.source]
+ )
+ assert hm.config.topdir == self.source
+ hm.init_rsync([].append)
+ dest = self.dest.join(self.source.basename)
+ assert dest.join("dir1").check()
+ assert dest.join("dir1", "dir2").check()
+ assert dest.join("dir1", "dir2", 'hello').check()
+
+ def test_hostmanager_init_rsync_roots(self):
dir2 = self.source.ensure("dir1", "dir2", dir=1)
self.source.ensure("dir1", "somefile", dir=1)
dir2.ensure("hello")
More information about the pytest-commit
mailing list