add CHANGELGOG, and make "-x" work harder to shut down immediately.

This commit is contained in:
holger krekel
2010-01-18 13:49:35 +01:00
parent 4594e5dbd8
commit b8ea732fb0
5 changed files with 30 additions and 7 deletions

11
CHANGELOG Normal file
View File

@@ -0,0 +1,11 @@
1.0
-------------------------
- moved code out of py-1.1.1 into its own plugin
- use a new, faster and more sensible model to do load-balancing
of tests - now no magic "MAXITEMSPERHOST" is needed and load-testing
works effectively even with very few tests.
- cleaned up termination handling
- make -x cause hard killing of test nodes to decrease wait time
until the traceback shows up on first failure

View File

@@ -20,7 +20,7 @@ setup(
packages = ['xdist'],
entry_points = {'pytest11': ['xdist = xdist.plugin'],},
zip_safe=False,
install_requires = ['execnet', 'py>=1.2.0'],
install_requires = ['execnet>=1.0.3', 'py>=1.2.0'],
classifiers=[
'Development Status :: 4 - Beta',
'Intended Audience :: Developers',

View File

@@ -266,9 +266,10 @@ class TestDSession:
session.queueevent("pytest_runtest_logreport", report=ev2)
# now call the loop
loopstate = session._initloopstate(items)
session.loop_once(loopstate)
from xdist.dsession import ExitFirstInterrupt
py.test.raises(ExitFirstInterrupt, "session.loop_once(loopstate)")
assert loopstate.testsfailed
assert loopstate.shuttingdown
#assert loopstate.shuttingdown
def test_shuttingdown_filters(self, testdir):
item = testdir.getitem("def test_func(): pass")

View File

@@ -57,6 +57,9 @@ class LoopState(object):
self.colitems[:] = items + self.colitems
self.dowork = False # avoid busywait
class ExitFirstInterrupt(KeyboardInterrupt):
pass
class DSession(Session):
"""
Session drives the collection and running of tests
@@ -129,6 +132,8 @@ class DSession(Session):
# termination conditions
if ((loopstate.testsfailed and self.config.option.exitfirst) or
(not self.item2nodes and not colitems and not self.queue.qsize())):
if self.config.option.exitfirst:
raise ExitFirstInterrupt()
self.triggershutdown()
loopstate.shuttingdown = True
elif not self.node2pending:
@@ -174,8 +179,11 @@ class DSession(Session):
break
except KeyboardInterrupt:
excinfo = py.code.ExceptionInfo()
self.config.hook.pytest_keyboard_interrupt(excinfo=excinfo)
exitstatus = outcome.EXIT_INTERRUPTED
if excinfo.errisinstance(ExitFirstInterrupt):
exitstatus = outcome.EXIT_TESTSFAILED
else:
self.config.hook.pytest_keyboard_interrupt(excinfo=excinfo)
exitstatus = outcome.EXIT_INTERRUPTED
except:
self.config.pluginmanager.notify_exception()
exitstatus = outcome.EXIT_INTERNALERROR

View File

@@ -74,8 +74,11 @@ class TXNode(object):
def sendlist(self, itemlist):
self.channel.send(itemlist)
def shutdown(self):
self.channel.send(None)
def shutdown(self, kill=False):
if kill:
self.gateway.exit()
else:
self.channel.send(None)
# setting up slave code
def install_slave(gateway, config):