def test_consider_env_plugin_instantiation( self, pytester: Pytester, monkeypatch: MonkeyPatch, pytestpm: PytestPluginManager, ) -> None: pytester.syspathinsert() pytester.makepyfile(xy123="#") monkeypatch.setitem(os.environ, "PYTEST_PLUGINS", "xy123") l1 = len(pytestpm.get_plugins()) pytestpm.consider_env() l2 = len(pytestpm.get_plugins()) assert l2 == l1 + 1 assert pytestpm.get_plugin("xy123") pytestpm.consider_env() l3 = len(pytestpm.get_plugins()) assert l2 == l3
def test_consider_env_fails_to_import( self, monkeypatch: MonkeyPatch, pytestpm: PytestPluginManager) -> None: monkeypatch.setenv("PYTEST_PLUGINS", "nonexisting", prepend=",") with pytest.raises(ImportError): pytestpm.consider_env()