MCPcopy
hub / github.com/pytest-dev/pytest / test_preparse_ordering_with_setuptools

Function test_preparse_ordering_with_setuptools

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

Source from the content-addressed store, hash-verified

1496
1497
1498def test_preparse_ordering_with_setuptools(
1499 pytester: Pytester, monkeypatch: MonkeyPatch
1500) -> None:
1501 monkeypatch.delenv("PYTEST_DISABLE_PLUGIN_AUTOLOAD", raising=False)
1502
1503 class EntryPoint:
1504 name = "mytestplugin"
1505 group = "pytest11"
1506
1507 def load(self):
1508 class PseudoPlugin:
1509 x = 42
1510
1511 return PseudoPlugin()
1512
1513 class Dist:
1514 files = ()
1515 metadata = {"name": "foo"}
1516 entry_points = (EntryPoint(),)
1517
1518 def my_dists():
1519 return (Dist,)
1520
1521 monkeypatch.setattr(importlib.metadata, "distributions", my_dists)
1522 pytester.makeconftest(
1523 """
1524 pytest_plugins = "mytestplugin",
1525 """
1526 )
1527 monkeypatch.setenv("PYTEST_PLUGINS", "mytestplugin")
1528 config = pytester.parseconfig()
1529 plugin = config.pluginmanager.getplugin("mytestplugin")
1530 assert plugin.x == 42
1531
1532
1533def 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