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

Function test_preparse_ordering_with_setuptools

testing/test_config.py:933–965  ·  view source on GitHub ↗
(
    pytester: Pytester, monkeypatch: MonkeyPatch
)

Source from the content-addressed store, hash-verified

931
932
933def test_preparse_ordering_with_setuptools(
934 pytester: Pytester, monkeypatch: MonkeyPatch
935) -> None:
936 monkeypatch.delenv("PYTEST_DISABLE_PLUGIN_AUTOLOAD", raising=False)
937
938 class EntryPoint:
939 name = "mytestplugin"
940 group = "pytest11"
941
942 def load(self):
943 class PseudoPlugin:
944 x = 42
945
946 return PseudoPlugin()
947
948 class Dist:
949 files = ()
950 metadata = {"name": "foo"}
951 entry_points = (EntryPoint(),)
952
953 def my_dists():
954 return (Dist,)
955
956 monkeypatch.setattr(importlib_metadata, "distributions", my_dists)
957 pytester.makeconftest(
958 """
959 pytest_plugins = "mytestplugin",
960 """
961 )
962 monkeypatch.setenv("PYTEST_PLUGINS", "mytestplugin")
963 config = pytester.parseconfig()
964 plugin = config.pluginmanager.getplugin("mytestplugin")
965 assert plugin.x == 42
966
967
968def test_setuptools_importerror_issue1479(

Callers

nothing calls this directly

Calls 6

delenvMethod · 0.80
setattrMethod · 0.80
setenvMethod · 0.80
getpluginMethod · 0.80
makeconftestMethod · 0.45
parseconfigMethod · 0.45

Tested by

no test coverage detected