MCPcopy Create free account
hub / github.com/pytest-dev/pytest / test_importlib_metadata_broken_distribution

Function test_importlib_metadata_broken_distribution

testing/test_config.py:994–1017  ·  view source on GitHub ↗

Integration test for broken distributions with 'files' metadata being None (#5389)

(
    pytester: Pytester, monkeypatch: MonkeyPatch
)

Source from the content-addressed store, hash-verified

992
993
994def test_importlib_metadata_broken_distribution(
995 pytester: Pytester, monkeypatch: MonkeyPatch
996) -> None:
997 """Integration test for broken distributions with 'files' metadata being None (#5389)"""
998 monkeypatch.delenv("PYTEST_DISABLE_PLUGIN_AUTOLOAD", raising=False)
999
1000 class DummyEntryPoint:
1001 name = "mytestplugin"
1002 group = "pytest11"
1003
1004 def load(self):
1005 return object()
1006
1007 class Distribution:
1008 version = "1.0"
1009 files = None
1010 metadata = {"name": "foo"}
1011 entry_points = (DummyEntryPoint(),)
1012
1013 def distributions():
1014 return (Distribution(),)
1015
1016 monkeypatch.setattr(importlib_metadata, "distributions", distributions)
1017 pytester.parseconfig()
1018
1019
1020@pytest.mark.parametrize("block_it", [True, False])

Callers

nothing calls this directly

Calls 3

delenvMethod · 0.80
setattrMethod · 0.80
parseconfigMethod · 0.45

Tested by

no test coverage detected