Skip to content

Commit ef98f1b

Browse files
prepare for Node.fspath deprecation
calculate topdir based on config.rootpath/rootdir addresses pytest-dev/pytest#8251
1 parent ad99d94 commit ef98f1b

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

changelog/623.bugfix.rst

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Gracefully handle the pending deprecation of Node.fspath by using config.rootpath for topdir.

src/xdist/remote.py

+6-1
Original file line numberDiff line numberDiff line change
@@ -93,9 +93,14 @@ def run_one_test(self, torun):
9393
)
9494

9595
def pytest_collection_finish(self, session):
96+
try:
97+
topdir = str(self.config.rootpath)
98+
except AttributeError: # pytest <= 6.1.0
99+
topdir = str(self.config.rootdir)
100+
96101
self.sendevent(
97102
"collectionfinish",
98-
topdir=str(session.fspath),
103+
topdir=topdir,
99104
ids=[item.nodeid for item in session.items],
100105
)
101106

0 commit comments

Comments
 (0)