diff options
author | Bruno Oliveira <nicoddemus@gmail.com> | 2020-06-12 19:35:38 -0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-06-12 19:35:38 -0300 |
commit | aaa6f1c3fab98adc04fde6cc971c2b385fb583f1 (patch) | |
tree | c09c295c4661a4b5a80230841b52c2efe05ad547 /testing/test_config.py | |
parent | 0f30103d9c79eae102b2935a268a3d18e95938e5 (diff) | |
parent | 1474f24c0746f5d9a51140b04ad01650f61974b8 (diff) | |
download | pytest-aaa6f1c3fab98adc04fde6cc971c2b385fb583f1.tar.gz |
Merge pull request #7330 from gnikonorov/issue_7305
Diffstat (limited to 'testing/test_config.py')
-rw-r--r-- | testing/test_config.py | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/testing/test_config.py b/testing/test_config.py index 31dfd9fa3..a10ac41dd 100644 --- a/testing/test_config.py +++ b/testing/test_config.py @@ -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 = () |