Skip to content

Commit

Permalink
prepare for Node.fspath deprecation
Browse files Browse the repository at this point in the history
calculate topdir based on config.rootpath/rootdir

addresses pytest-dev/pytest#8251
  • Loading branch information
RonnyPfannschmidt committed Feb 7, 2021
1 parent ad99d94 commit ef98f1b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
1 change: 1 addition & 0 deletions changelog/623.bugfix.rst
@@ -0,0 +1 @@
Gracefully handle the pending deprecation of Node.fspath by using config.rootpath for topdir.
7 changes: 6 additions & 1 deletion src/xdist/remote.py
Expand Up @@ -93,9 +93,14 @@ def run_one_test(self, torun):
)

def pytest_collection_finish(self, session):
try:
topdir = str(self.config.rootpath)
except AttributeError: # pytest <= 6.1.0
topdir = str(self.config.rootdir)

self.sendevent(
"collectionfinish",
topdir=str(session.fspath),
topdir=topdir,
ids=[item.nodeid for item in session.items],
)

Expand Down

0 comments on commit ef98f1b

Please sign in to comment.