See also https://github.com/pytest-dev/pytest/pull/12616

--- pytest-9.0.1/testing/test_assertion.py.orig
+++ pytest-9.0.1/testing/test_assertion.py
@@ -233,20 +233,24 @@
             monkeypatch.setenv("PYTEST_DISABLE_PLUGIN_AUTOLOAD", "1")
         elif disable_plugin_autoload == "cli":
             monkeypatch.delenv("PYTEST_DISABLE_PLUGIN_AUTOLOAD", raising=False)
+            monkeypatch.delenv("PYTEST_PLUGINS", raising=False)
             args.append("--disable-plugin-autoload")
         else:
             assert disable_plugin_autoload == ""
             monkeypatch.delenv("PYTEST_DISABLE_PLUGIN_AUTOLOAD", raising=False)
+            monkeypatch.delenv("PYTEST_PLUGINS", raising=False)
 
         name = "spamplugin"
 
         if explicit_specify == "env_var":
             monkeypatch.setenv("PYTEST_PLUGINS", name)
         elif explicit_specify == "cli":
+            monkeypatch.delenv("PYTEST_PLUGINS", raising=False)
             args.append("-p")
             args.append(name)
         else:
             assert explicit_specify == ""
+            monkeypatch.delenv("PYTEST_PLUGINS", raising=False)
 
         # Make sure the hook is installed early enough so that plugins
         # installed via distribution package are rewritten.
--- pytest-9.0.1/testing/test_config.py.orig
+++ pytest-9.0.1/testing/test_config.py
@@ -625,6 +625,7 @@
 
         monkeypatch.setattr(importlib.metadata, "distributions", my_dists)
         monkeypatch.delenv("PYTEST_DISABLE_PLUGIN_AUTOLOAD", raising=False)
+        monkeypatch.delenv("PYTEST_PLUGINS", raising=False)
 
         pytester.makeini(ini_file_text)
 
@@ -1472,6 +1473,7 @@
     pytester: Pytester, monkeypatch: MonkeyPatch
 ) -> None:
     monkeypatch.delenv("PYTEST_DISABLE_PLUGIN_AUTOLOAD", raising=False)
+    monkeypatch.delenv("PYTEST_PLUGINS", raising=False)
 
     class EntryPoint:
         name = "mytestplugin"
@@ -1507,6 +1509,7 @@
     pytester: Pytester, monkeypatch: MonkeyPatch
 ) -> None:
     monkeypatch.delenv("PYTEST_DISABLE_PLUGIN_AUTOLOAD", raising=False)
+    monkeypatch.delenv("PYTEST_PLUGINS", raising=False)
 
     class DummyEntryPoint:
         name = "mytestplugin"
@@ -1534,6 +1537,7 @@
 ) -> None:
     """Integration test for broken distributions with 'files' metadata being None (#5389)"""
     monkeypatch.delenv("PYTEST_DISABLE_PLUGIN_AUTOLOAD", raising=False)
+    monkeypatch.delenv("PYTEST_PLUGINS", raising=False)
 
     class DummyEntryPoint:
         name = "mytestplugin"
@@ -1560,6 +1564,7 @@
     pytester: Pytester, monkeypatch: MonkeyPatch, block_it: bool
 ) -> None:
     monkeypatch.delenv("PYTEST_DISABLE_PLUGIN_AUTOLOAD", raising=False)
+    monkeypatch.delenv("PYTEST_PLUGINS", raising=False)
 
     plugin_module_placeholder = object()
 
@@ -1632,17 +1637,21 @@
         monkeypatch.setenv("PYTEST_DISABLE_PLUGIN_AUTOLOAD", "1")
     elif disable_plugin_method == "flag":
         monkeypatch.delenv("PYTEST_DISABLE_PLUGIN_AUTOLOAD")
+        monkeypatch.delenv("PYTEST_PLUGINS", raising=False)
         parse_args.append("--disable-plugin-autoload")
     else:
         assert disable_plugin_method == ""
         monkeypatch.delenv("PYTEST_DISABLE_PLUGIN_AUTOLOAD")
+        monkeypatch.delenv("PYTEST_PLUGINS", raising=False)
 
     if enable_plugin_method == "env_var":
         monkeypatch.setenv("PYTEST_PLUGINS", "mytestplugin")
     elif enable_plugin_method == "flag":
+        monkeypatch.delenv("PYTEST_PLUGINS", raising=False)
         parse_args.extend(["-p", "mytestplugin"])
     else:
         assert enable_plugin_method == ""
+        monkeypatch.delenv("PYTEST_PLUGINS", raising=False)
 
     monkeypatch.setattr(importlib.metadata, "distributions", distributions)
     monkeypatch.setitem(sys.modules, "mytestplugin", PseudoPlugin())
@@ -1668,7 +1677,7 @@
     # Except when autoloads aren't disabled, in which case PytestPluginManager.import_plugin
     # bails out before importing it.. because it knows it'll be loaded later?
     # The above seems a bit weird, but I *think* it's true.
-    if platform.python_implementation() != "PyPy":
+    if platform.python_implementation() != "PyPy" and not sys.platform.startswith("sunos5"):
         assert ("__spec__" in PseudoPlugin.attrs_used) == bool(
             enable_plugin_method == "env_var" and disable_plugin_method
         )
--- pytest-9.0.1/testing/test_helpconfig.py.orig
+++ pytest-9.0.1/testing/test_helpconfig.py
@@ -66,7 +66,7 @@
     )
 
 
-def test_empty_help_param(pytester: Pytester) -> None:
+def test_empty_help_param(pytester: Pytester, monkeypatch) -> None:
     """Test that an empty help param is displayed correctly."""
     pytester.makeconftest(
         """
@@ -74,6 +74,7 @@
             parser.addini("test_ini", "", default=True, type="bool")
     """
     )
+    monkeypatch.delenv("PYTEST_PLUGINS", raising=False)
     result = pytester.runpytest("--help")
     assert result.ret == ExitCode.OK
     lines = [
--- pytest-9.0.1/testing/test_terminal.py.orig
+++ pytest-9.0.1/testing/test_terminal.py
@@ -2386,7 +2386,6 @@
         self, many_tests_files, pytester: Pytester, monkeypatch
     ) -> None:
         pytest.importorskip("xdist")
-        monkeypatch.delenv("PYTEST_DISABLE_PLUGIN_AUTOLOAD", raising=False)
         pytester.makeini(
             """
             [pytest]
