Merge pull request #7330 from gnikonorov/issue_7305
This commit is contained in:
@@ -224,6 +224,60 @@ class TestParseIni:
|
||||
with pytest.raises(pytest.fail.Exception, match=exception_text):
|
||||
testdir.runpytest("--strict-config")
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"ini_file_text, exception_text",
|
||||
[
|
||||
(
|
||||
"""
|
||||
[pytest]
|
||||
required_plugins = fakePlugin1 fakePlugin2
|
||||
""",
|
||||
"Missing required plugins: fakePlugin1, fakePlugin2",
|
||||
),
|
||||
(
|
||||
"""
|
||||
[pytest]
|
||||
required_plugins = a pytest-xdist z
|
||||
""",
|
||||
"Missing required plugins: a, z",
|
||||
),
|
||||
(
|
||||
"""
|
||||
[pytest]
|
||||
required_plugins = a q j b c z
|
||||
""",
|
||||
"Missing required plugins: a, b, c, j, q, z",
|
||||
),
|
||||
(
|
||||
"""
|
||||
[some_other_header]
|
||||
required_plugins = wont be triggered
|
||||
[pytest]
|
||||
minversion = 5.0.0
|
||||
""",
|
||||
"",
|
||||
),
|
||||
(
|
||||
"""
|
||||
[pytest]
|
||||
minversion = 5.0.0
|
||||
""",
|
||||
"",
|
||||
),
|
||||
],
|
||||
)
|
||||
def test_missing_required_plugins(self, testdir, ini_file_text, exception_text):
|
||||
pytest.importorskip("xdist")
|
||||
|
||||
testdir.tmpdir.join("pytest.ini").write(textwrap.dedent(ini_file_text))
|
||||
testdir.monkeypatch.delenv("PYTEST_DISABLE_PLUGIN_AUTOLOAD")
|
||||
|
||||
if exception_text:
|
||||
with pytest.raises(pytest.fail.Exception, match=exception_text):
|
||||
testdir.parseconfig()
|
||||
else:
|
||||
testdir.parseconfig()
|
||||
|
||||
|
||||
class TestConfigCmdlineParsing:
|
||||
def test_parsing_again_fails(self, testdir):
|
||||
@@ -681,6 +735,7 @@ def test_preparse_ordering_with_setuptools(testdir, monkeypatch):
|
||||
|
||||
class Dist:
|
||||
files = ()
|
||||
metadata = {"name": "foo"}
|
||||
entry_points = (EntryPoint(),)
|
||||
|
||||
def my_dists():
|
||||
@@ -711,6 +766,7 @@ def test_setuptools_importerror_issue1479(testdir, monkeypatch):
|
||||
class Distribution:
|
||||
version = "1.0"
|
||||
files = ("foo.txt",)
|
||||
metadata = {"name": "foo"}
|
||||
entry_points = (DummyEntryPoint(),)
|
||||
|
||||
def distributions():
|
||||
@@ -735,6 +791,7 @@ def test_importlib_metadata_broken_distribution(testdir, monkeypatch):
|
||||
class Distribution:
|
||||
version = "1.0"
|
||||
files = None
|
||||
metadata = {"name": "foo"}
|
||||
entry_points = (DummyEntryPoint(),)
|
||||
|
||||
def distributions():
|
||||
@@ -760,6 +817,7 @@ def test_plugin_preparse_prevents_setuptools_loading(testdir, monkeypatch, block
|
||||
class Distribution:
|
||||
version = "1.0"
|
||||
files = ("foo.txt",)
|
||||
metadata = {"name": "foo"}
|
||||
entry_points = (DummyEntryPoint(),)
|
||||
|
||||
def distributions():
|
||||
@@ -791,6 +849,7 @@ def test_disable_plugin_autoload(testdir, monkeypatch, parse_args, should_load):
|
||||
return sys.modules[self.name]
|
||||
|
||||
class Distribution:
|
||||
metadata = {"name": "foo"}
|
||||
entry_points = (DummyEntryPoint(),)
|
||||
files = ()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user