Skip to content

Commit 9f9b707

Browse files
authored
Remove pytest 2.8 compatibility code (#451)
Remove pytest 2.8 compatibility code
2 parents 4642f16 + 2ca058e commit 9f9b707

File tree

2 files changed

+11
-24
lines changed

2 files changed

+11
-24
lines changed

src/xdist/plugin.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -154,11 +154,7 @@ def pytest_addoption(parser):
154154
def pytest_addhooks(pluginmanager):
155155
from xdist import newhooks
156156

157-
# avoid warnings with pytest-2.8
158-
method = getattr(pluginmanager, "add_hookspecs", None)
159-
if method is None:
160-
method = pluginmanager.addhooks
161-
method(newhooks)
157+
pluginmanager.add_hookspecs(newhooks)
162158

163159

164160
# -------------------------------------------------------------------------

testing/conftest.py

Lines changed: 10 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,19 @@
1+
import six
12
import py
23
import pytest
34
import execnet
45

5-
6-
@pytest.fixture(scope="session", autouse=True)
7-
def _ensure_imports():
8-
# we import some modules because pytest-2.8's testdir fixture
9-
# will unload all modules after each test and this cause
10-
# (unknown) problems with execnet.Group()
11-
execnet.Group
12-
execnet.makegateway
13-
14-
156
pytest_plugins = "pytester"
167

17-
# rsyncdirs = ['.', '../xdist', py.path.local(execnet.__file__).dirpath()]
8+
if six.PY2:
9+
10+
@pytest.fixture(scope="session", autouse=True)
11+
def _ensure_imports():
12+
# we import some modules because pytest-2.8's testdir fixture
13+
# will unload all modules after each test and this cause
14+
# (unknown) problems with execnet.Group()
15+
execnet.Group
16+
execnet.makegateway
1817

1918

2019
@pytest.fixture(autouse=True)
@@ -45,14 +44,6 @@ def specssh(request):
4544
return getspecssh(request.config)
4645

4746

48-
@pytest.fixture
49-
def testdir(testdir):
50-
# pytest before 2.8 did not have a runpytest_subprocess
51-
if not hasattr(testdir, "runpytest_subprocess"):
52-
testdir.runpytest_subprocess = testdir.runpytest
53-
return testdir
54-
55-
5647
# configuration information for tests
5748
def getgspecs(config):
5849
return [execnet.XSpec(spec) for spec in config.getvalueorskip("gspecs")]

0 commit comments

Comments
 (0)