fixes to various tests, related to execnet automatic ID generation and other bits.

also lowering the version as "1.1.1post1" for now.  1.1.2 is still a bit off.

--HG--
branch : trunk
This commit is contained in:
holger krekel 2009-12-24 19:43:14 +01:00
parent 98863d1d01
commit f254b6f7c1
9 changed files with 28 additions and 26 deletions

View File

@ -9,7 +9,7 @@ dictionary or an import path.
(c) Holger Krekel and others, 2009
"""
version = "1.1.2"
version = "1.1.1post1"
__version__ = version = version or "1.1.x"
import py.apipkg

View File

@ -215,6 +215,7 @@ class DSession(Session):
for node, pending in self.node2pending.items():
room = min(self.MAXITEMSPERHOST - len(pending), room)
sending = tosend[:room]
if sending:
for node, pending in self.node2pending.items():
node.sendlist(sending)
pending.extend(sending)

View File

@ -42,7 +42,7 @@ class TXNode(object):
if eventcall == self.ENDMARK:
err = self.channel._getremoteerror()
if not self._down:
if not err:
if not err or isinstance(err, EOFError):
err = "Not properly terminated"
self.notify("pytest_testnodedown", node=self, error=err)
self._down = True

View File

@ -16,9 +16,10 @@ def pytest_addoption(parser):
help="start pdb (the Python debugger) on errors.")
def pytest_configure(config):
def pytest_configure(__multicall__, config):
if config.option.usepdb:
if execnet:
__multicall__.execute()
if config.getvalue("looponfail"):
raise config.Error("--pdb incompatible with --looponfail.")
if config.option.dist != "no":

View File

@ -28,7 +28,7 @@ def main():
name='py',
description='py.test and pylib: rapid testing and development utils.',
long_description = long_description,
version= trunk or '1.1.2',
version= trunk or '1.1.1post1',
url='http://pylib.org',
license='MIT license',
platforms=['unix', 'linux', 'osx', 'cygwin', 'win32'],

View File

@ -36,8 +36,8 @@ class TestPDB:
assert i == 1
""")
child = testdir.spawn_pytest("--pdb %s" % p1)
#child.expect(".*def test_1.*")
child.expect(".*i = 0.*")
child.expect(".*def test_1")
child.expect(".*i = 0")
child.expect("(Pdb)")
child.sendeof()
child.expect("1 failed")
@ -50,7 +50,7 @@ class TestPDB:
py.test.raises(Error, "testdir.parseconfigure('--pdb', '--looponfail')")
result = testdir.runpytest("--pdb", "-n", "3")
assert result.ret != 0
assert "incompatible" in result.stdout.str()
assert "incompatible" in result.stderr.str()
result = testdir.runpytest("--pdb", "-d", "--tx", "popen")
assert result.ret != 0
assert "incompatible" in result.stdout.str()
assert "incompatible" in result.stderr.str()

View File

@ -49,8 +49,8 @@ class TestDistribution:
)
result = testdir.runpytest(p1, '-d', '--tx=popen', '--tx=popen')
result.stdout.fnmatch_lines([
"*0*popen*Python*",
"*1*popen*Python*",
"*2*popen*Python*",
"*2 failed, 1 passed, 1 skipped*",
])
assert result.ret == 1
@ -73,9 +73,9 @@ class TestDistribution:
""")
result = testdir.runpytest(p1, '-d')
result.stdout.fnmatch_lines([
"*0*popen*Python*",
"*1*popen*Python*",
"*2*popen*Python*",
"*3*popen*Python*",
"*2 failed, 1 passed, 1 skipped*",
])
assert result.ret == 1
@ -122,7 +122,7 @@ class TestDistribution:
"--tx=popen//chdir=%(dest)s" % locals(), p)
assert result.ret == 0
result.stdout.fnmatch_lines([
"*1* *popen*platform*",
"*0* *popen*platform*",
#"RSyncStart: [G1]",
#"RSyncFinished: [G1]",
"*1 passed*"

View File

@ -37,10 +37,10 @@ class TestGatewayManagerPopen:
hm.makegateways()
call = hookrecorder.popcall("pytest_gwmanage_newgateway")
assert call.gateway.spec == execnet.XSpec("popen")
assert call.gateway.id == "1"
assert call.gateway.id == "gw0"
assert call.platinfo.executable == call.gateway._rinfo().executable
call = hookrecorder.popcall("pytest_gwmanage_newgateway")
assert call.gateway.id == "2"
assert call.gateway.id == "gw1"
assert len(hm.group) == 2
hm.exit()
assert not len(hm.group)
@ -66,7 +66,7 @@ class TestGatewayManagerPopen:
l = []
hm.rsync(source, notify=lambda *args: l.append(args))
assert len(l) == 1
assert l[0] == ("rsyncrootready", hm.group['1'].spec, source)
assert l[0] == ("rsyncrootready", hm.group['gw0'].spec, source)
hm.exit()
dest = dest.join(source.basename)
assert dest.join("dir1").check()

View File

@ -79,7 +79,7 @@ class TestMasterSlaveConnection:
node.send(123) # invalid item
kwargs = mysetup.geteventargs("pytest_testnodedown")
assert kwargs['node'] is node
assert str(kwargs['error']).find("AttributeError") != -1
assert "Not properly terminated" in str(kwargs['error'])
def test_crash_killed(self, testdir, mysetup):
if not hasattr(py.std.os, 'kill'):
@ -87,13 +87,13 @@ class TestMasterSlaveConnection:
item = testdir.getitem("""
def test_func():
import os
os.kill(os.getpid(), 15)
os.kill(os.getpid(), 9)
""")
node = mysetup.makenode(item.config)
node.send(item)
kwargs = mysetup.geteventargs("pytest_testnodedown")
assert kwargs['node'] is node
assert str(kwargs['error']).find("Not properly terminated") != -1
assert "Not properly terminated" in str(kwargs['error'])
def test_node_down(self, mysetup):
node = mysetup.makenode()