예제 #1
0
 def test_plugins__get_package_paths_with_package(self):
     # the _get_package_paths() call uses __import__ to load a
     # python library, and then uses the __file__ attribute of
     # the result for that to get the library path, so we mock
     # that here and patch the builtin to use our mocked result
     foo = MagicMock()
     bar = MagicMock()
     bam = MagicMock()
     bam.__file__ = '/path/to/my/foo/bar/bam/__init__.py'
     bar.bam = bam
     foo.return_value.bar = bar
     pl = PluginLoader('test', 'foo.bar.bam', 'test', 'test_plugin')
     with patch('{0}.__import__'.format(BUILTINS), foo):
         self.assertEqual(pl._get_package_paths(), ['/path/to/my/foo/bar/bam'])
예제 #2
0
 def test_plugins__get_package_paths_with_package(self):
     # the _get_package_paths() call uses __import__ to load a
     # python library, and then uses the __file__ attribute of
     # the result for that to get the library path, so we mock
     # that here and patch the builtin to use our mocked result
     foo = MagicMock()
     bar = MagicMock()
     bam = MagicMock()
     bam.__file__ = '/path/to/my/foo/bar/bam/__init__.py'
     bar.bam = bam
     foo.return_value.bar = bar
     pl = PluginLoader('test', 'foo.bar.bam', 'test', 'test_plugin')
     with patch('{0}.__import__'.format(BUILTINS), foo):
         self.assertEqual(pl._get_package_paths(), ['/path/to/my/foo/bar/bam'])
예제 #3
0
 def test_plugins__get_package_paths_no_package(self):
     pl = PluginLoader('test', '', 'test', 'test_plugin')
     self.assertEqual(pl._get_package_paths(), [])
예제 #4
0
 def test_plugins__get_package_paths_no_package(self):
     pl = PluginLoader('test', '', 'test', 'test_plugin')
     self.assertEqual(pl._get_package_paths(), [])