[py-svn] r63019 - in py/trunk/py: io test/dsession test/dsession/testing
hpk at codespeak.net
hpk at codespeak.net
Wed Mar 18 01:38:06 CET 2009
Author: hpk
Date: Wed Mar 18 01:38:02 2009
New Revision: 63019
Modified:
py/trunk/py/io/terminalwriter.py
py/trunk/py/test/dsession/hostmanage.py
py/trunk/py/test/dsession/testing/test_hostmanage.py
Log:
some simple ssh tests, always transfer py lib as rsyncroot
Modified: py/trunk/py/io/terminalwriter.py
==============================================================================
--- py/trunk/py/io/terminalwriter.py (original)
+++ py/trunk/py/io/terminalwriter.py Wed Mar 18 01:38:02 2009
@@ -96,7 +96,7 @@
if esc and sys.platform == "win32" and file.isatty():
if 1 in esc:
bold = True
- esc = tuple(x for x in esc if x != 1)
+ esc = tuple([x for x in esc if x != 1])
else:
bold = False
esctable = {() : FOREGROUND_WHITE, # normal
Modified: py/trunk/py/test/dsession/hostmanage.py
==============================================================================
--- py/trunk/py/test/dsession/hostmanage.py (original)
+++ py/trunk/py/test/dsession/hostmanage.py Wed Mar 18 01:38:02 2009
@@ -25,9 +25,16 @@
conftestroots = config.getconftest_pathlist("rsyncdirs")
if conftestroots:
roots.extend(conftestroots)
+ pydir = py.path.local(py.__file__).dirpath()
for root in roots:
if not root.check():
raise ValueError("rsyncdir doesn't exist: %r" %(root,))
+ if pydir is not None and root.basename == "py":
+ if root != pydir:
+ raise ValueError("root %r conflicts with current %r" %(root, pydir))
+ pydir = None
+ if pydir is not None:
+ roots.append(pydir)
return roots
class HostManager(object):
@@ -98,6 +105,11 @@
""" % nice).waitclose()
self.trace_hoststatus()
+ multigw = self.gwmanager.getgateways(inplacelocal=False, remote=True)
+ multigw.remote_exec("""
+ import os, sys
+ sys.path.insert(0, os.getcwd())
+ """).waitclose()
for gateway in self.gwmanager.gateways:
host = gateway.spec
Modified: py/trunk/py/test/dsession/testing/test_hostmanage.py
==============================================================================
--- py/trunk/py/test/dsession/testing/test_hostmanage.py (original)
+++ py/trunk/py/test/dsession/testing/test_hostmanage.py Wed Mar 18 01:38:02 2009
@@ -33,6 +33,7 @@
hm = HostManager(session.config, hosts=[1,2,3])
assert hm.hosts == [1,2,3]
+ @py.test.mark.xfail("consider / forbid implicit rsyncdirs?")
def test_hostmanager_rsync_roots_no_roots(self, source, dest):
source.ensure("dir1", "file1").write("hello")
config = py.test.config._reparse([source])
@@ -133,6 +134,18 @@
assert l
hm.teardown_hosts()
+ def test_hostmanage_ssh_setup_hosts(self, testdir):
+ sshhost = py.test.config.getvalueorskip("sshhost")
+ testdir.makepyfile(__init__="", test_x="""
+ def test_one():
+ pass
+ """)
+
+ sorter = testdir.inline_run("-d", "--rsyncdirs=%s" % testdir.tmpdir,
+ "--gateways=%s" % sshhost, testdir.tmpdir)
+ ev = sorter.getfirstnamed("itemtestreport")
+ assert ev.passed
+
@py.test.mark.xfail("implement double-rsync test")
def test_ssh_rsync_samehost_twice(self):
option = py.test.config.option
@@ -162,8 +175,8 @@
def test_getconfigroots(testdir):
config = testdir.parseconfig('--rsyncdirs=' + str(testdir.tmpdir))
roots = getconfigroots(config)
- assert len(roots) == 1
- assert roots == [testdir.tmpdir]
+ assert len(roots) == 1 + 1
+ assert testdir.tmpdir in roots
def test_getconfigroots_with_conftest(testdir):
testdir.chdir()
@@ -175,7 +188,7 @@
""")
config = testdir.parseconfig(testdir.tmpdir, '--rsyncdirs=y,z')
roots = getconfigroots(config)
- assert len(roots) == 3
+ assert len(roots) == 3 + 1
assert py.path.local('y') in roots
assert py.path.local('z') in roots
assert testdir.tmpdir.join('x') in roots
More information about the pytest-commit
mailing list