Merge pull request #558 from nicoddemus/fix-rsync-dirs

Fix rsyncdirs usage with pytest 6.0
This commit is contained in:
Bruno Oliveira
2020-07-13 15:09:48 -03:00
committed by GitHub
3 changed files with 11 additions and 3 deletions

1
changelog/558.bugfix.rst Normal file
View File

@@ -0,0 +1 @@
Fix ``rsyncdirs`` usage with pytest 6.0.

View File

@@ -90,8 +90,16 @@ class NodeManager(object):
import pytest import pytest
import _pytest import _pytest
pytestpath = pytest.__file__.rstrip("co") def get_dir(p):
pytestdir = py.path.local(_pytest.__file__).dirpath() """Return the directory path if p is a package or the path to the .py file otherwise."""
stripped = p.rstrip("co")
if os.path.basename(stripped) == "__init__.py":
return os.path.dirname(p)
else:
return stripped
pytestpath = get_dir(pytest.__file__)
pytestdir = get_dir(_pytest.__file__)
config = self.config config = self.config
candidates = [py._pydir, pytestpath, pytestdir] candidates = [py._pydir, pytestpath, pytestdir]
candidates += config.option.rsyncdir candidates += config.option.rsyncdir

View File

@@ -189,7 +189,6 @@ class TestDistribution:
) )
assert result.ret == 1 assert result.ret == 1
@pytest.mark.xfail(reason="#527: Ignore Python 3.8 failure for the time being")
def test_distribution_rsyncdirs_example(self, testdir, monkeypatch): def test_distribution_rsyncdirs_example(self, testdir, monkeypatch):
# use a custom plugin that has a custom command-line option to ensure # use a custom plugin that has a custom command-line option to ensure
# this is propagated to workers (see #491) # this is propagated to workers (see #491)