Skip to content

Commit

Permalink
Remove pytest 2.8 compatibility code
Browse files Browse the repository at this point in the history
  • Loading branch information
nicoddemus committed Jul 11, 2019
1 parent a19d74d commit 2ca058e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 24 deletions.
6 changes: 1 addition & 5 deletions src/xdist/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,11 +154,7 @@ def pytest_addoption(parser):
def pytest_addhooks(pluginmanager):
from xdist import newhooks

# avoid warnings with pytest-2.8
method = getattr(pluginmanager, "add_hookspecs", None)
if method is None:
method = pluginmanager.addhooks
method(newhooks)
pluginmanager.add_hookspecs(newhooks)


# -------------------------------------------------------------------------
Expand Down
29 changes: 10 additions & 19 deletions testing/conftest.py
Original file line number Diff line number Diff line change
@@ -1,20 +1,19 @@
import six
import py
import pytest
import execnet


@pytest.fixture(scope="session", autouse=True)
def _ensure_imports():
# we import some modules because pytest-2.8's testdir fixture
# will unload all modules after each test and this cause
# (unknown) problems with execnet.Group()
execnet.Group
execnet.makegateway


pytest_plugins = "pytester"

# rsyncdirs = ['.', '../xdist', py.path.local(execnet.__file__).dirpath()]
if six.PY2:

@pytest.fixture(scope="session", autouse=True)
def _ensure_imports():
# we import some modules because pytest-2.8's testdir fixture
# will unload all modules after each test and this cause
# (unknown) problems with execnet.Group()
execnet.Group
execnet.makegateway


@pytest.fixture(autouse=True)
Expand Down Expand Up @@ -45,14 +44,6 @@ def specssh(request):
return getspecssh(request.config)


@pytest.fixture
def testdir(testdir):
# pytest before 2.8 did not have a runpytest_subprocess
if not hasattr(testdir, "runpytest_subprocess"):
testdir.runpytest_subprocess = testdir.runpytest
return testdir


# configuration information for tests
def getgspecs(config):
return [execnet.XSpec(spec) for spec in config.getvalueorskip("gspecs")]
Expand Down

0 comments on commit 2ca058e

Please sign in to comment.