@mock.patch("%s.os.path.isdir" % DISCOVER, return_value=True)
    @mock.patch("%s.imp.load_module" % DISCOVER)
    @mock.patch("%s.imp.find_module" % DISCOVER,
                return_value=(mock.MagicMock(), None, None))
    @mock.patch("%s.os.walk" % DISCOVER, return_value=[
        ("/somewhere", ("/subdir", ), ("plugin1.py", )),
        ("/somewhere/subdir", ("/subsubdir", ), ("plugin2.py",
                                                 "withoutextension")),
        ("/somewhere/subdir/subsubdir", [], ("plugin3.py", ))])
    def test_load_plugins_from_dir_successful(self, mock_os_walk,
                                              mock_find_module,
                                              mock_load_module, mock_isdir):
        test_path = "/somewhere"
        discover.load_plugins(test_path)
        expected = [
            mock.call("plugin1", ["/somewhere"]),
            mock.call("plugin2", ["/somewhere/subdir"]),
            mock.call("plugin3", ["/somewhere/subdir/subsubdir"])
        ]
        self.assertEqual(expected, mock_find_module.mock_calls)
        self.assertEqual(3, len(mock_load_module.mock_calls))
dataset/ETHPy150Open openstack/rally/tests/unit/common/plugin/test_discover.py/LoadExtraModulesTestCase.test_load_plugins_from_dir_successful/original