From ef98f1b1841e9ae8a4c3884ee3cf7be543ae3b2c 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 00000000..107d188d --- /dev/null +++ b/changelog/623.bugfix.rst @@ -0,0 +1 @@ +Gracefully handle the pending deprecation of Node.fspath by using config.rootpath for topdir. \ No newline at end of file diff --git a/src/xdist/remote.py b/src/xdist/remote.py index aaa45bed..0c739c84 100644 --- a/src/xdist/remote.py +++ b/src/xdist/remote.py @@ -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], )