testing/conftest.py: testdir: set PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 (#6655)

Fixes https://github.com/pytest-dev/pytest/pull/4518.
This commit is contained in:
Daniel Hahler 2020-02-04 02:59:20 +01:00 committed by GitHub
parent aa0328782f
commit 4316fe8a92
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 13 additions and 0 deletions

View File

@ -104,6 +104,8 @@ class TestGeneralUsage:
@pytest.mark.parametrize("load_cov_early", [True, False])
def test_early_load_setuptools_name(self, testdir, monkeypatch, load_cov_early):
monkeypatch.delenv("PYTEST_DISABLE_PLUGIN_AUTOLOAD")
testdir.makepyfile(mytestplugin1_module="")
testdir.makepyfile(mytestplugin2_module="")
testdir.makepyfile(mycov_module="")

View File

@ -1,6 +1,7 @@
import sys
import pytest
from _pytest.pytester import Testdir
if sys.gettrace():
@ -118,3 +119,9 @@ def dummy_yaml_custom_test(testdir):
"""
)
testdir.makefile(".yaml", test1="")
@pytest.fixture
def testdir(testdir: Testdir) -> Testdir:
testdir.monkeypatch.setenv("PYTEST_DISABLE_PLUGIN_AUTOLOAD", "1")
return testdir

View File

@ -3,6 +3,7 @@ from _pytest.main import ExitCode
def test_version(testdir, pytestconfig):
testdir.monkeypatch.delenv("PYTEST_DISABLE_PLUGIN_AUTOLOAD")
result = testdir.runpytest("--version")
assert result.ret == 0
# p = py.path.local(py.__file__).dirpath()

View File

@ -1227,6 +1227,7 @@ def test_runs_twice(testdir, run_and_parse):
def test_runs_twice_xdist(testdir, run_and_parse):
pytest.importorskip("xdist")
testdir.monkeypatch.delenv("PYTEST_DISABLE_PLUGIN_AUTOLOAD")
f = testdir.makepyfile(
"""
def test_pass():

View File

@ -604,6 +604,7 @@ class TestTerminalFunctional:
assert result.ret == 0
def test_header_trailer_info(self, testdir, request):
testdir.monkeypatch.delenv("PYTEST_DISABLE_PLUGIN_AUTOLOAD")
testdir.makepyfile(
"""
def test_passes():
@ -714,6 +715,7 @@ class TestTerminalFunctional:
if not pytestconfig.pluginmanager.get_plugin("xdist"):
pytest.skip("xdist plugin not installed")
testdir.monkeypatch.delenv("PYTEST_DISABLE_PLUGIN_AUTOLOAD")
result = testdir.runpytest(
verbose_testfile, "-v", "-n 1", "-Walways::pytest.PytestWarning"
)