def test_plugins_given_as_strings(
        self, pytester: Pytester, monkeypatch, _sys_snapshot
    ) -> None:
        """Test that str values passed to main() as `plugins` arg are
        interpreted as module names to be imported and registered (#855)."""
        with pytest.raises(ImportError) as excinfo:
            pytest.main([str(pytester.path)], plugins=["invalid.module"])
        assert "invalid" in str(excinfo.value)

        p = pytester.path.joinpath("test_test_plugins_given_as_strings.py")
        p.write_text("def test_foo(): pass", encoding="utf-8")
        mod = types.ModuleType("myplugin")
        monkeypatch.setitem(sys.modules, "myplugin", mod)
        assert pytest.main(args=[str(pytester.path)], plugins=["myplugin"]) == 0
Test that str values passed to main() as `plugins` arg are
        interpreted as module names to be imported and registered (#855).
testing/acceptance_test.py