Skip to content

Commit

Permalink
New solution that does not require change to dsession
Browse files Browse the repository at this point in the history
  • Loading branch information
bbrown1867 committed Mar 23, 2024
1 parent fdf0669 commit c7a19c3
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/xdist/dsession.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ def worker_workerfinished(self, node):
self.shouldstop = f"{node} received keyboard-interrupt"
self.worker_errordown(node, "keyboard-interrupt")
return
if not self.shouldstop and node in self.sched.nodes:
if node in self.sched.nodes:
crashitem = self.sched.remove_node(node)
assert not crashitem, (crashitem, node)
self._active_nodes.remove(node)
Expand Down
11 changes: 6 additions & 5 deletions src/xdist/remote.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,12 +154,10 @@ def pytest_runtestloop(self, session):
self.channel.setcallback(self.handle_command, endmarker=self.SHUTDOWN_MARK)
self.nextitem_index = self._get_next_item_index()
while self.nextitem_index is not self.SHUTDOWN_MARK:
self.run_one_test()
if session.shouldfail or session.shouldstop:
break
self.run_one_test(session.shouldfail or session.shouldstop)
return True

def run_one_test(self):
def run_one_test(self, skip: bool):
self.item_index = self.nextitem_index
self.nextitem_index = self._get_next_item_index()

Expand All @@ -173,7 +171,10 @@ def run_one_test(self):
worker_title("[pytest-xdist running] %s" % item.nodeid)

start = time.time()
self.config.hook.pytest_runtest_protocol(item=item, nextitem=nextitem)

if not skip:
self.config.hook.pytest_runtest_protocol(item=item, nextitem=nextitem)

duration = time.time() - start

worker_title("[pytest-xdist idle]")
Expand Down

0 comments on commit c7a19c3

Please sign in to comment.