class_docstr: Tests for `ProfileRedirectPluginLoader`.
code: def test_loads_when_no_dynamic_plugin(self):
      with contextlib.ExitStack() as stack:
          stack.enter_context(mock.patch.dict(sys.modules))
          sys.modules.pop(_DYNAMIC_PLUGIN_MODULE, None)
  
          real_import = __import__
  
          def fake_import(name, *args, **kwargs):
              if name == _DYNAMIC_PLUGIN_MODULE:
                  raise ImportError("Pretend I'm not here")
              else:
                  return real_import(name, *args, **kwargs)
  
          stack.enter_context(
              mock.patch("builtins.__import__", fake_import)
          )
  
          plugin_class = profile_redirect_plugin._ProfileRedirectPlugin
          plugin_init = stack.enter_context(
              mock.patch.object(
                  plugin_class, "__init__", return_value=None
              )
          )
  
          loader = profile_redirect_plugin.ProfileRedirectPluginLoader()
          context = base_plugin.TBContext()
          result = loader.load(context)
          self.assertIsInstance(result, plugin_class)
          plugin_init.assert_called_once_with(context)
  
file_path: tensorboard/tensorboard/plugins/profile_redirect/profile_redirect_plugin_test.py
imports: import contextlib
  import sys
  from unittest import mock
  from tensorboard.plugins import base_plugin
  from tensorboard.plugins.profile_redirect import profile_redirect_plugin
  from tensorboard import test
label_desc: Use image node_id 1 for calling the ProfileRedirectPluginLoaderTest obj's underlying member method code with example usage: obj.test_loads_when_no_dynamic_plugin() and returns: real_import