adapt to collection -> session renaming of pytest core
This commit is contained in:
2
setup.py
2
setup.py
@@ -10,7 +10,7 @@ from setuptools import setup
|
|||||||
|
|
||||||
setup(
|
setup(
|
||||||
name="pytest-xdist",
|
name="pytest-xdist",
|
||||||
version='1.5a5',
|
version='1.5a6',
|
||||||
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=__doc__,
|
long_description=__doc__,
|
||||||
license='GPLv2 or later',
|
license='GPLv2 or later',
|
||||||
|
|||||||
@@ -1,2 +1,2 @@
|
|||||||
#
|
#
|
||||||
__version__ = '1.5a5'
|
__version__ = '1.5a6'
|
||||||
@@ -143,30 +143,16 @@ class SlaveFailSession:
|
|||||||
|
|
||||||
def pytest_collection(self, session):
|
def pytest_collection(self, session):
|
||||||
self.session = session
|
self.session = session
|
||||||
self.collection = collection = session.collection
|
|
||||||
self.trails = self.current_command
|
self.trails = self.current_command
|
||||||
hook = self.collection.ihook
|
hook = self.session.ihook
|
||||||
try:
|
try:
|
||||||
items = collection.perform_collect(self.trails or None)
|
items = session.perform_collect(self.trails or None)
|
||||||
except pytest.UsageError:
|
except pytest.UsageError:
|
||||||
items = collection.perform_collect(None)
|
items = session.perform_collect(None)
|
||||||
hook.pytest_collection_modifyitems(config=session.config, items=items)
|
hook.pytest_collection_modifyitems(session=session, config=session.config, items=items)
|
||||||
hook.pytest_collection_finish(collection=collection)
|
hook.pytest_collection_finish(session=session)
|
||||||
return True
|
return True
|
||||||
|
|
||||||
if self.trails:
|
|
||||||
col = self.collection
|
|
||||||
items = []
|
|
||||||
for trail in self.trails:
|
|
||||||
names = col._parsearg(trail)
|
|
||||||
try:
|
|
||||||
for node in col.matchnodes([col._topcollector], names):
|
|
||||||
items.extend(col.genitems(node))
|
|
||||||
except pytest.UsageError:
|
|
||||||
pass # ignore collect errors / vanished tests
|
|
||||||
self.collection.items = items
|
|
||||||
return True
|
|
||||||
|
|
||||||
def pytest_runtest_logreport(self, report):
|
def pytest_runtest_logreport(self, report):
|
||||||
if report.failed:
|
if report.failed:
|
||||||
self.recorded_failures.append(report)
|
self.recorded_failures.append(report)
|
||||||
|
|||||||
@@ -32,7 +32,6 @@ class SlaveInteractor:
|
|||||||
|
|
||||||
def pytest_sessionstart(self, session):
|
def pytest_sessionstart(self, session):
|
||||||
self.session = session
|
self.session = session
|
||||||
self.collection = session.collection
|
|
||||||
slaveinfo = getinfodict()
|
slaveinfo = getinfodict()
|
||||||
self.sendevent("slaveready", slaveinfo=slaveinfo)
|
self.sendevent("slaveready", slaveinfo=slaveinfo)
|
||||||
|
|
||||||
@@ -56,20 +55,20 @@ class SlaveInteractor:
|
|||||||
item = self._id2item[nodeid]
|
item = self._id2item[nodeid]
|
||||||
self.config.hook.pytest_runtest_protocol(item=item)
|
self.config.hook.pytest_runtest_protocol(item=item)
|
||||||
elif name == "runtests_all":
|
elif name == "runtests_all":
|
||||||
for item in self.collection.items:
|
for item in session.items:
|
||||||
self.config.hook.pytest_runtest_protocol(item=item)
|
self.config.hook.pytest_runtest_protocol(item=item)
|
||||||
elif name == "shutdown":
|
elif name == "shutdown":
|
||||||
break
|
break
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def pytest_collection_finish(self, collection):
|
def pytest_collection_finish(self, session):
|
||||||
self._id2item = {}
|
self._id2item = {}
|
||||||
ids = []
|
ids = []
|
||||||
for item in collection.items:
|
for item in session.items:
|
||||||
self._id2item[item.nodeid] = item
|
self._id2item[item.nodeid] = item
|
||||||
ids.append(item.nodeid)
|
ids.append(item.nodeid)
|
||||||
self.sendevent("collectionfinish",
|
self.sendevent("collectionfinish",
|
||||||
topdir=str(collection.fspath),
|
topdir=str(session.fspath),
|
||||||
ids=ids)
|
ids=ids)
|
||||||
|
|
||||||
#def pytest_runtest_logstart(self, nodeid, location, fspath):
|
#def pytest_runtest_logstart(self, nodeid, location, fspath):
|
||||||
|
|||||||
Reference in New Issue
Block a user