Compare commits

...

10 Commits
1.7 ... 1.8

Author SHA1 Message Date
holger krekel
0387c57b76 merge 2011-12-16 11:59:17 +00:00
holger krekel
bca7a5c35b Added tag 1.8 for changeset 0d1c00018008 2011-12-16 11:57:23 +00:00
holger krekel
689bf7262e streamline MANIFEST file 2011-12-16 11:47:28 +00:00
holger krekel
5488b6d9a1 bump versions 2011-12-16 10:47:33 +00:00
holger krekel
aed7a5a07e fix tests by properly removing __pycache__ files 2011-12-15 07:41:09 +01:00
holger krekel
927e95176f try py31/py32 environments in tox.ini 2011-12-12 21:12:25 +00:00
holger krekel
8c6fea9895 remove usage of final_logerrors now that we have better teardown information 2011-12-02 21:03:58 +00:00
holger krekel
1f6d410481 fix issue 93 of pytest - avoid delayed teardowns 2011-12-02 21:03:29 +00:00
holger krekel
d5ff8b066a tag 1.7 2011-11-18 19:08:05 +00:00
holger krekel
750ada16d1 Added tag 1.7 for changeset 29c38e195526 2011-11-18 19:07:56 +00:00
13 changed files with 55 additions and 51 deletions

View File

@@ -8,3 +8,6 @@ a423748bf17ee778a37853225210257699cad9c1 1.4
cd44a941c833c098e4899fe3d42a96703754d0d5 1.5 cd44a941c833c098e4899fe3d42a96703754d0d5 1.5
4815040bdad8f182a5487f57a9da385483836e75 1.6 4815040bdad8f182a5487f57a9da385483836e75 1.6
20875fed94e7f3dff50bdf762df91153b15ceca6 1.7 20875fed94e7f3dff50bdf762df91153b15ceca6 1.7
20875fed94e7f3dff50bdf762df91153b15ceca6 1.7
29c38e195526f5f0fdd651fb51f59d6efaaafbb0 1.7
0d1c00018008433956aa7d93007bab6ea7de96e4 1.8

View File

@@ -1,3 +1,9 @@
1.8
-------------------------
- fix pytest-issue93 - use the refined pytest-2.2.1 runtestprotocol
interface to perform eager teardowns for test items.
1.7 1.7
------------------------- -------------------------

View File

@@ -3,8 +3,4 @@ include LICENSE
include README.txt include README.txt
include setup.py include setup.py
graft testing graft testing
exclude *.orig
exclude *.rej
recursive-exclude testing *.pyc *$py.class
prune .svn
prune .hg prune .hg

View File

@@ -2,7 +2,7 @@ from setuptools import setup
setup( setup(
name="pytest-xdist", name="pytest-xdist",
version='1.7.dev1', version='1.8',
description='py.test xdist plugin for distributed testing and loop-on-failing modes', description='py.test xdist plugin for distributed testing and loop-on-failing modes',
long_description=open('README.txt').read(), long_description=open('README.txt').read(),
license='GPLv2 or later', license='GPLv2 or later',
@@ -13,7 +13,7 @@ setup(
packages = ['xdist'], packages = ['xdist'],
entry_points = {'pytest11': ['xdist = xdist.plugin'],}, entry_points = {'pytest11': ['xdist = xdist.plugin'],},
zip_safe=False, zip_safe=False,
install_requires = ['execnet>=1.0.8', 'pytest>=2.2.0'], install_requires = ['execnet>=1.0.8', 'pytest>=2.2.1'],
classifiers=[ classifiers=[
'Development Status :: 5 - Production/Stable', 'Development Status :: 5 - Production/Stable',
'Intended Audience :: Developers', 'Intended Audience :: Developers',

View File

@@ -314,7 +314,7 @@ def test_teardownfails_one_function(testdir):
@py.test.mark.xfail @py.test.mark.xfail
def test_terminate_on_hangingnode(testdir): def test_terminate_on_hangingnode(testdir):
p = testdir.makeconftest(""" p = testdir.makeconftest("""
def pytest__teardown_final(session): def pytest_sessionfinishes(session):
if session.nodeid == "my": # running on slave if session.nodeid == "my": # running on slave
import time import time
time.sleep(3) time.sleep(3)

View File

@@ -48,11 +48,11 @@ class TestEachScheduling:
assert sched.node2collection[node1] == collection assert sched.node2collection[node1] == collection
assert sched.node2collection[node2] == collection assert sched.node2collection[node2] == collection
sched.init_distribute() sched.init_distribute()
assert not sched.tests_finished() assert sched.tests_finished()
assert node1.sent == ['ALL'] assert node1.sent == ['ALL']
assert node2.sent == ['ALL'] assert node2.sent == ['ALL']
sched.remove_item(node1, collection[0]) sched.remove_item(node1, collection[0])
assert not sched.tests_finished() assert sched.tests_finished()
sched.remove_item(node2, collection[0]) sched.remove_item(node2, collection[0])
assert sched.tests_finished() assert sched.tests_finished()
@@ -66,7 +66,7 @@ class TestEachScheduling:
assert sched.collection_is_completed assert sched.collection_is_completed
assert sched.node2collection[node1] == collection assert sched.node2collection[node1] == collection
sched.init_distribute() sched.init_distribute()
assert not sched.tests_finished() assert sched.tests_finished()
crashitem = sched.remove_node(node1) crashitem = sched.remove_node(node1)
assert crashitem assert crashitem
assert sched.tests_finished() assert sched.tests_finished()
@@ -88,7 +88,7 @@ class TestLoadScheduling:
assert sched.node2collection[node1] == collection assert sched.node2collection[node1] == collection
assert sched.node2collection[node2] == collection assert sched.node2collection[node2] == collection
sched.init_distribute() sched.init_distribute()
assert not sched.tests_finished() assert sched.tests_finished()
assert len(node1.sent) == 1 assert len(node1.sent) == 1
assert len(node2.sent) == 1 assert len(node2.sent) == 1
x = sorted(node1.sent + node2.sent) x = sorted(node1.sent + node2.sent)
@@ -109,6 +109,7 @@ class TestLoadScheduling:
sched.addnode_collection(node1, col) sched.addnode_collection(node1, col)
sched.addnode_collection(node2, col) sched.addnode_collection(node2, col)
sched.init_distribute() sched.init_distribute()
#assert not sched.tests_finished()
sent1 = node1.sent sent1 = node1.sent
sent2 = node2.sent sent2 = node2.sent
chunkitems = col[:sched.ITEM_CHUNKSIZE] chunkitems = col[:sched.ITEM_CHUNKSIZE]

View File

@@ -88,16 +88,14 @@ class TestRemoteControl:
assert not failures assert not failures
def test_failures_somewhere(self, testdir): def test_failures_somewhere(self, testdir):
item = testdir.getitem("def test_func(): assert 0\n") item = testdir.getitem("def test_func():\n assert 0\n")
control = RemoteControl(item.config) control = RemoteControl(item.config)
control.setup() control.setup()
failures = control.runsession() failures = control.runsession()
assert failures assert failures
control.setup() control.setup()
item.fspath.write("def test_func(): assert 1\n") item.fspath.write("def test_func():\n assert 1\n")
pyc = item.fspath.new(ext=".pyc") removepyc(item.fspath)
if pyc.check():
pyc.remove()
topdir, failures = control.runsession()[:2] topdir, failures = control.runsession()[:2]
assert not failures assert not failures
@@ -115,9 +113,7 @@ class TestRemoteControl:
def test_new(): def test_new():
assert 0 assert 0
""")) """))
pyc = modcol.fspath.new(ext=".pyc") removepyc(modcol.fspath)
if pyc.check():
pyc.remove()
control.loop_once() control.loop_once()
assert not control.failures assert not control.failures
control.loop_once() control.loop_once()
@@ -252,4 +248,7 @@ def removepyc(path):
pyc = path + "c" pyc = path + "c"
if pyc.check(): if pyc.check():
pyc.remove() pyc.remove()
c = path.dirpath("__pycache__")
if c.check():
c.remove()

View File

@@ -138,6 +138,7 @@ class TestSlaveInteractor:
ids = ev.kwargs['ids'] ids = ev.kwargs['ids']
assert len(ids) == 1 assert len(ids) == 1
slave.sendcommand("runtests", ids=ids) slave.sendcommand("runtests", ids=ids)
slave.sendcommand("shutdown")
ev = slave.popevent("testreport") # setup ev = slave.popevent("testreport") # setup
ev = slave.popevent("testreport") ev = slave.popevent("testreport")
assert ev.name == "testreport" assert ev.name == "testreport"
@@ -145,7 +146,6 @@ class TestSlaveInteractor:
assert rep.nodeid.endswith("::test_func") assert rep.nodeid.endswith("::test_func")
assert rep.passed assert rep.passed
assert rep.when == "call" assert rep.when == "call"
slave.sendcommand("shutdown")
ev = slave.popevent("slavefinished") ev = slave.popevent("slavefinished")
assert 'slaveoutput' in ev.kwargs assert 'slaveoutput' in ev.kwargs

View File

@@ -9,10 +9,10 @@ changedir=testing
deps=:testrun:pytest>=2.2.0.dev2 deps=:testrun:pytest>=2.2.0.dev2
commands= py.test --junitxml={envlogdir}/junit-{envname}.xml [] commands= py.test --junitxml={envlogdir}/junit-{envname}.xml []
[testenv:py31] #[testenv:py31]
deps=:pypi:pytest # XXX needed because ClueRelease/pip broken #deps=:pypi:pytest # XXX needed because ClueRelease/pip broken
[testenv:py32] #[testenv:py32]
deps=:pypi:pytest # XXX needed because ClueRelease/pip broken #deps=:pypi:pytest # XXX needed because ClueRelease/pip broken
[testenv:py26] [testenv:py26]
deps= deps=
@@ -21,3 +21,4 @@ deps=
[pytest] [pytest]
addopts = -rsfxX addopts = -rsfxX
;; hello

View File

@@ -1,2 +1,2 @@
# #
__version__ = '1.7.dev1' __version__ = '1.8'

View File

@@ -24,9 +24,6 @@ class EachScheduling:
def tests_finished(self): def tests_finished(self):
if not self.collection_is_completed: if not self.collection_is_completed:
return False return False
for items in self.node2pending.values():
if items:
return False
return True return True
def addnode_collection(self, node, collection): def addnode_collection(self, node, collection):
@@ -79,9 +76,9 @@ class LoadScheduling:
def tests_finished(self): def tests_finished(self):
if not self.collection_is_completed or self.pending: if not self.collection_is_completed or self.pending:
return False return False
for items in self.node2pending.values(): #for items in self.node2pending.values():
if items: # if items:
return False # return False
return True return True
def addnode_collection(self, node, collection): def addnode_collection(self, node, collection):
@@ -107,7 +104,7 @@ class LoadScheduling:
pending.append(item) pending.append(item)
self.item2nodes.setdefault(item, []).append(node) self.item2nodes.setdefault(item, []).append(node)
node.send_runtest(item) node.send_runtest(item)
#self.log("items waiting for node: %d" %(len(self.pending))) self.log("items waiting for node: %d" %(len(self.pending)))
#self.log("item2pending still executing: %s" %(self.item2nodes,)) #self.log("item2pending still executing: %s" %(self.item2nodes,))
#self.log("node2pending: %s" %(self.node2pending,)) #self.log("node2pending: %s" %(self.node2pending,))
@@ -287,10 +284,6 @@ class DSession:
self.config.hook.pytest_runtest_logreport(report=rep) self.config.hook.pytest_runtest_logreport(report=rep)
self._handlefailures(rep) self._handlefailures(rep)
def slave_teardownreport(self, node, rep):
rep.node = node
self.config.hook.pytest__teardown_final_logerror(report=rep)
def slave_collectreport(self, node, rep): def slave_collectreport(self, node, rep):
#self.report_line("collectreport %s: %s" %(rep.id, rep.status)) #self.report_line("collectreport %s: %s" %(rep.id, rep.status))
#rep.node = node #rep.node = node

View File

@@ -26,10 +26,6 @@ class SlaveInteractor:
for line in str(excrepr).split("\n"): for line in str(excrepr).split("\n"):
self.log("IERROR> " + line) self.log("IERROR> " + line)
def pytest__teardown_final_logerror(self, report):
rep = serialize_report(report)
self.sendevent("teardownreport", data=rep)
def pytest_sessionstart(self, session): def pytest_sessionstart(self, session):
self.session = session self.session = session
slaveinfo = getinfodict() slaveinfo = getinfodict()
@@ -46,18 +42,26 @@ class SlaveInteractor:
def pytest_runtestloop(self, session): def pytest_runtestloop(self, session):
self.log("entering main loop") self.log("entering main loop")
torun = []
while 1: while 1:
name, kwargs = self.channel.receive() name, kwargs = self.channel.receive()
self.log("received command %s(**%s)" % (name, kwargs)) self.log("received command %s(**%s)" % (name, kwargs))
if name == "runtests": if name == "runtests":
ids = kwargs['ids'] ids = kwargs['ids']
for nodeid in ids: for nodeid in ids:
item = self._id2item[nodeid] torun.append(self._id2item[nodeid])
self.config.hook.pytest_runtest_protocol(item=item)
elif name == "runtests_all": elif name == "runtests_all":
for item in session.items: torun.extend(session.items)
self.config.hook.pytest_runtest_protocol(item=item) self.log("items to run: %s" %(len(torun)))
elif name == "shutdown": while len(torun) >= 2:
item = torun.pop(0)
nextitem = torun[0]
self.config.hook.pytest_runtest_protocol(item=item,
nextitem=nextitem)
if name == "shutdown":
while torun:
self.config.hook.pytest_runtest_protocol(
item=torun.pop(0), nextitem=None)
break break
return True return True
@@ -118,7 +122,7 @@ def remote_initconfig(option_dict, args):
config.option.numprocesses = None config.option.numprocesses = None
config.args = args config.args = args
return config return config
if __name__ == '__channelexec__': if __name__ == '__channelexec__':
slaveinput,args,option_dict = channel.receive() slaveinput,args,option_dict = channel.receive()

View File

@@ -183,7 +183,7 @@ def make_reltoroot(roots, args):
raise ValueError("arg %s not relative to an rsync root" % (arg,)) raise ValueError("arg %s not relative to an rsync root" % (arg,))
l.append(splitcode.join(parts)) l.append(splitcode.join(parts))
return l return l
class SlaveController(object): class SlaveController(object):
ENDMARK = -1 ENDMARK = -1
@@ -237,8 +237,11 @@ class SlaveController(object):
self.sendcommand("runtests_all",) self.sendcommand("runtests_all",)
def shutdown(self): def shutdown(self):
if not self._down and not self.channel.isclosed(): if not self._down:
self.sendcommand("shutdown") try:
self.sendcommand("shutdown")
except IOError:
pass
def sendcommand(self, name, **kwargs): def sendcommand(self, name, **kwargs):
""" send a named parametrized command to the other side. """ """ send a named parametrized command to the other side. """
@@ -298,5 +301,3 @@ def unserialize_report(name, reportdict):
return runner.TestReport(**d) return runner.TestReport(**d)
elif name == "collectreport": elif name == "collectreport":
return runner.CollectReport(**d) return runner.CollectReport(**d)
elif name == "teardownreport":
return runner.TeardownErrorReport(**d)