Skip to content

Commit faabbfe

Browse files
committed
Fix rsyncdirs usage with pytest 6.0
Fix pytest-dev/pytest#7487
1 parent 727c41e commit faabbfe

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

src/xdist/workermanage.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,16 @@ def _getrsyncdirs(self):
9090
import pytest
9191
import _pytest
9292

93-
pytestpath = pytest.__file__.rstrip("co")
94-
pytestdir = py.path.local(_pytest.__file__).dirpath()
93+
def get_dir(p):
94+
"""Return the directory path if p is a package or the path to the .py file otherwise."""
95+
stripped = p.rstrip("co")
96+
if os.path.basename(stripped) == "__init__.py":
97+
return os.path.dirname(p)
98+
else:
99+
return stripped
100+
101+
pytestpath = get_dir(pytest.__file__)
102+
pytestdir = get_dir(_pytest.__file__)
95103
config = self.config
96104
candidates = [py._pydir, pytestpath, pytestdir]
97105
candidates += config.option.rsyncdir

testing/acceptance_test.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,6 @@ def test_crash():
189189
)
190190
assert result.ret == 1
191191

192-
@pytest.mark.xfail(reason="#527: Ignore Python 3.8 failure for the time being")
193192
def test_distribution_rsyncdirs_example(self, testdir, monkeypatch):
194193
# use a custom plugin that has a custom command-line option to ensure
195194
# this is propagated to workers (see #491)

0 commit comments

Comments
 (0)