From aa89c42ad7d344a979d44c83bd3089931b09a9d3 Mon Sep 17 00:00:00 2001 From: Ronny Pfannschmidt Date: Sun, 7 Feb 2021 20:37:40 +0100 Subject: [PATCH] prepare for Node.fspath deprecation calculate topdir based on config.rootpath/rootdir addresses pytest-dev/pytest#8251 --- changelog/623.bugfix.rst | 1 + src/xdist/remote.py | 7 ++++++- 2 files changed, 7 insertions(+), 1 deletion(-) create mode 100644 changelog/623.bugfix.rst diff --git a/changelog/623.bugfix.rst b/changelog/623.bugfix.rst new file mode 100644 index 0000000..13397f9 --- /dev/null +++ b/changelog/623.bugfix.rst @@ -0,0 +1 @@ +Gracefully handle the pending deprecation of Node.fspath by using config.rootpath for topdir. diff --git a/src/xdist/remote.py b/src/xdist/remote.py index aaa45be..9aaf91b 100644 --- a/src/xdist/remote.py +++ b/src/xdist/remote.py @@ -93,9 +93,14 @@ class WorkerInteractor: ) 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], )