(
pytester: Pytester, monkeypatch: MonkeyPatch
)
| 1496 | |
| 1497 | |
| 1498 | def 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 | |
| 1533 | def test_setuptools_importerror_issue1479( |
nothing calls this directly
no test coverage detected