From 2ca058e38a5244bce9738d62ed5166a4386992f8 Mon Sep 17 00:00:00 2001 From: Bruno Oliveira Date: Wed, 10 Jul 2019 20:02:36 -0300 Subject: [PATCH] Remove pytest 2.8 compatibility code --- src/xdist/plugin.py | 6 +----- testing/conftest.py | 29 ++++++++++------------------- 2 files changed, 11 insertions(+), 24 deletions(-) diff --git a/src/xdist/plugin.py b/src/xdist/plugin.py index 49b9f38..9f1f7dd 100644 --- a/src/xdist/plugin.py +++ b/src/xdist/plugin.py @@ -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) # ------------------------------------------------------------------------- diff --git a/testing/conftest.py b/testing/conftest.py index dd01f3e..66fbac6 100644 --- a/testing/conftest.py +++ b/testing/conftest.py @@ -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) @@ -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")]