Skip to content

Commit

Permalink
adapt to collection -> session renaming of pytest core
Browse files Browse the repository at this point in the history
  • Loading branch information
hpk42 committed Nov 7, 2010
1 parent 9d55d3c commit 8272a66
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 26 deletions.
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

setup(
name="pytest-xdist",
version='1.5a5',
version='1.5a6',
description='py.test xdist plugin for distributed testing and loop-on-failing modes',
long_description=__doc__,
license='GPLv2 or later',
Expand Down
2 changes: 1 addition & 1 deletion xdist/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
#
__version__ = '1.5a5'
__version__ = '1.5a6'
24 changes: 5 additions & 19 deletions xdist/looponfail.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,30 +143,16 @@ def DEBUG(self, *args):

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)
Expand Down
9 changes: 4 additions & 5 deletions xdist/remote.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ def pytest__teardown_final_logerror(self, report):

def pytest_sessionstart(self, session):
self.session = session
self.collection = session.collection
slaveinfo = getinfodict()
self.sendevent("slaveready", slaveinfo=slaveinfo)

Expand All @@ -56,20 +55,20 @@ def pytest_runtestloop(self, session):
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):
Expand Down

0 comments on commit 8272a66

Please sign in to comment.