code: def test_namespace_path_modification(self):
      import pelican
      import pelican.plugins
  
      old_path = pelican.__path__[:]
  
      # not existing path
      path = os.path.join(self._PLUGIN_FOLDER, "foo")
      with tmp_namespace_path(path):
          self.assertIn(os.path.join(path, "pelican"), pelican.__path__)
          # foo/pelican does not exist, so it won't propagate
          self.assertNotIn(
              os.path.join(path, "pelican", "plugins"),
              pelican.plugins.__path__,
          )
      # verify that we restored path back
      self.assertEqual(pelican.__path__, old_path)
  
      # existing path
      with tmp_namespace_path(self._NS_PLUGIN_FOLDER):
          self.assertIn(
              os.path.join(self._NS_PLUGIN_FOLDER, "pelican"),
              pelican.__path__,
          )
          # /namespace_plugin/pelican exists, so it should be in
          self.assertIn(
              os.path.join(
                  self._NS_PLUGIN_FOLDER, "pelican", "plugins"
              ),
              pelican.plugins.__path__,
          )
      self.assertEqual(pelican.__path__, old_path)
  
file_path: pelican/pelican/tests/test_plugins.py
imports: import os
  from contextlib import contextmanager
  import pelican.tests.dummy_plugins.normal_plugin.normal_plugin
  from pelican.plugins._utils import get_namespace_plugins, get_plugin_name, load_plugins, plugin_enabled
  from pelican.plugins.signals import signal
  from pelican.tests.support import unittest
label_desc: Use image node_id 1 for calling the PluginTest obj's underlying member method code with example usage: obj.test_namespace_path_modification() without return types