예제 #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
     m = MagicMock()
     m.return_value.__file__ = '/path/to/my/test.py'
     pl = PluginLoader('test', 'foo.bar.bam', 'test', 'test_plugin')
     with patch('{0}.__import__'.format(BUILTINS), m):
         self.assertEqual(pl._get_package_paths(), ['/path/to/my/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
     m = MagicMock()
     m.return_value.__file__ = '/path/to/my/test.py'
     pl = PluginLoader('test', 'foo.bar.bam', 'test', 'test_plugin')
     with patch('{0}.__import__'.format(BUILTINS), m):
         self.assertEqual(pl._get_package_paths(), ['/path/to/my/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(), [])