diff --git a/src/_pytest/pytester.py b/src/_pytest/pytester.py index 6b45e077b48..66a1e2a171f 100644 --- a/src/_pytest/pytester.py +++ b/src/_pytest/pytester.py @@ -539,7 +539,11 @@ def __init__(self, request, tmpdir_factory): # Environment (updates) for inner runs. tmphome = str(self.tmpdir) - self._env_run_update = {"HOME": tmphome, "USERPROFILE": tmphome} + self._env_run_update = { + "HOME": tmphome, + "USERPROFILE": tmphome, + "PYTEST_DISABLE_PLUGIN_AUTOLOAD": "1", + } def __repr__(self): return "".format(self.tmpdir) diff --git a/testing/acceptance_test.py b/testing/acceptance_test.py index 578ab45eb03..084cc8245a0 100644 --- a/testing/acceptance_test.py +++ b/testing/acceptance_test.py @@ -104,6 +104,8 @@ def test_option(pytestconfig): @pytest.mark.parametrize("load_cov_early", [True, False]) def test_early_load_setuptools_name(self, testdir, monkeypatch, load_cov_early): + del testdir._env_run_update["PYTEST_DISABLE_PLUGIN_AUTOLOAD"] + testdir.makepyfile(mytestplugin1_module="") testdir.makepyfile(mytestplugin2_module="") testdir.makepyfile(mycov_module="") diff --git a/testing/test_helpconfig.py b/testing/test_helpconfig.py index 962750f7b3a..c945a5cc2d6 100644 --- a/testing/test_helpconfig.py +++ b/testing/test_helpconfig.py @@ -3,6 +3,7 @@ def test_version(testdir, pytestconfig): + del testdir._env_run_update["PYTEST_DISABLE_PLUGIN_AUTOLOAD"] result = testdir.runpytest("--version") assert result.ret == 0 # p = py.path.local(py.__file__).dirpath() diff --git a/testing/test_junitxml.py b/testing/test_junitxml.py index 885d259415b..73d2ef49efe 100644 --- a/testing/test_junitxml.py +++ b/testing/test_junitxml.py @@ -1226,6 +1226,7 @@ def test_pass(): def test_runs_twice_xdist(testdir, run_and_parse): pytest.importorskip("xdist") + del testdir._env_run_update["PYTEST_DISABLE_PLUGIN_AUTOLOAD"] f = testdir.makepyfile( """ def test_pass(): diff --git a/testing/test_terminal.py b/testing/test_terminal.py index 1bec577b865..50ea773af22 100644 --- a/testing/test_terminal.py +++ b/testing/test_terminal.py @@ -595,6 +595,7 @@ def test_method(self): assert result.ret == 0 def test_header_trailer_info(self, testdir, request): + del testdir._env_run_update["PYTEST_DISABLE_PLUGIN_AUTOLOAD"] testdir.makepyfile( """ def test_passes(): @@ -705,6 +706,7 @@ def test_verbose_reporting_xdist(self, verbose_testfile, testdir, pytestconfig): if not pytestconfig.pluginmanager.get_plugin("xdist"): pytest.skip("xdist plugin not installed") + del testdir._env_run_update["PYTEST_DISABLE_PLUGIN_AUTOLOAD"] result = testdir.runpytest( verbose_testfile, "-v", "-n 1", "-Walways::pytest.PytestWarning" )