adapt to collection -> session renaming of pytest core
This commit is contained in:
@@ -1,2 +1,2 @@
|
||||
#
|
||||
__version__ = '1.5a5'
|
||||
__version__ = '1.5a6'
|
||||
@@ -143,30 +143,16 @@ class SlaveFailSession:
|
||||
|
||||
def pytest_collection(self, session):
|
||||
self.session = session
|
||||
self.collection = collection = session.collection
|
||||
self.trails = self.current_command
|
||||
hook = self.collection.ihook
|
||||
hook = self.session.ihook
|
||||
try:
|
||||
items = collection.perform_collect(self.trails or None)
|
||||
items = session.perform_collect(self.trails or None)
|
||||
except pytest.UsageError:
|
||||
items = collection.perform_collect(None)
|
||||
hook.pytest_collection_modifyitems(config=session.config, items=items)
|
||||
hook.pytest_collection_finish(collection=collection)
|
||||
items = session.perform_collect(None)
|
||||
hook.pytest_collection_modifyitems(session=session, config=session.config, items=items)
|
||||
hook.pytest_collection_finish(session=session)
|
||||
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):
|
||||
if report.failed:
|
||||
self.recorded_failures.append(report)
|
||||
|
||||
@@ -32,7 +32,6 @@ class SlaveInteractor:
|
||||
|
||||
def pytest_sessionstart(self, session):
|
||||
self.session = session
|
||||
self.collection = session.collection
|
||||
slaveinfo = getinfodict()
|
||||
self.sendevent("slaveready", slaveinfo=slaveinfo)
|
||||
|
||||
@@ -56,20 +55,20 @@ class SlaveInteractor:
|
||||
item = self._id2item[nodeid]
|
||||
self.config.hook.pytest_runtest_protocol(item=item)
|
||||
elif name == "runtests_all":
|
||||
for item in self.collection.items:
|
||||
for item in session.items:
|
||||
self.config.hook.pytest_runtest_protocol(item=item)
|
||||
elif name == "shutdown":
|
||||
break
|
||||
return True
|
||||
|
||||
def pytest_collection_finish(self, collection):
|
||||
def pytest_collection_finish(self, session):
|
||||
self._id2item = {}
|
||||
ids = []
|
||||
for item in collection.items:
|
||||
for item in session.items:
|
||||
self._id2item[item.nodeid] = item
|
||||
ids.append(item.nodeid)
|
||||
self.sendevent("collectionfinish",
|
||||
topdir=str(collection.fspath),
|
||||
topdir=str(session.fspath),
|
||||
ids=ids)
|
||||
|
||||
#def pytest_runtest_logstart(self, nodeid, location, fspath):
|
||||
|
||||
Reference in New Issue
Block a user