(
pytester: Pytester, monkeypatch: MonkeyPatch
)
| 931 | |
| 932 | |
| 933 | def 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 | |
| 968 | def test_setuptools_importerror_issue1479( |
nothing calls this directly
no test coverage detected