code: def test_load_setuptools_instantiation(monkeypatch, pm):
      class EntryPoint(object):
          name = "myname"
          group = "hello"
          value = "myname:foo"
  
          def load(self):
              class PseudoPlugin(object):
                  x = 42
  
              return PseudoPlugin()
  
      class Distribution(object):
          entry_points = (EntryPoint(),)
  
      dist = Distribution()
  
      def my_distributions():
          return (dist,)
  
      monkeypatch.setattr(
          importlib_metadata, "distributions", my_distributions
      )
      num = pm.load_setuptools_entrypoints("hello")
      assert num == 1
      plugin = pm.get_plugin("myname")
      assert plugin.x == 42
      ret = pm.list_plugin_distinfo()
      # poor man's `assert ret == [(plugin, mock.ANY)]`
      assert len(ret) == 1
      assert len(ret[0]) == 2
      assert ret[0][0] == plugin
      assert ret[0][1]._dist == dist
      num = pm.load_setuptools_entrypoints("hello")
      assert num == 0
  
imports: import pytest
  import types
  from pluggy import PluginManager, PluginValidationError, HookCallError, HookimplMarker, HookspecMarker
  from pluggy.manager import importlib_metadata
label_desc: Use image node_id 21 for calling a global function with example usage: test_load_setuptools_instantiation(monkeypatch, pm) and returns: dist, PseudoPlugin