Ejemplo n.º 1
0
 def test_git_update_with_submodules(self, fake_repo, local_folder_exists,
                                     *_):
     local_folder_exists.return_value = True
     git_clone([self.require_with_submodule])
     fake_repo.assert_called_with(self.expected_local_repo_path)
     repo = fake_repo.return_value
     repo.git.submodule.assert_called_with("update")
Ejemplo n.º 2
0
def handle_requires(requires):
    pypi_pkgs = []
    git_repos = []
    for require in requires:
        if isinstance(require, dict):
            require_type = require.get(constants.REQUIRE_TYPE, "")
            if require_type.upper() == constants.GIT_REQUIRE:
                git_repos.append(
                    GitRequire(
                        git_url=require.get(constants.GIT_URL),
                        branch=require.get(constants.GIT_BRANCH),
                        submodule=require.get(constants.GIT_HAS_SUBMODULE,
                                              False),
                    ))
            elif require_type.upper() == constants.PYPI_REQUIRE:
                pypi_pkgs.append(require.get(constants.PYPI_PACKAGE_NAME))
        else:
            if is_repo(require):
                git_repos.append(GitRequire(require))
            else:
                pypi_pkgs.append(require)
    if pypi_pkgs:
        pip_install(pypi_pkgs)
        plugins.make_sure_all_pkg_are_loaded()
    if git_repos:
        git_clone(git_repos)
Ejemplo n.º 3
0
 def test_checkout_new(self, fake_repo, local_folder_exists, *_):
     local_folder_exists.return_value = False
     git_clone([self.require])
     fake_repo.clone_from.assert_called_with(
         self.repo,
         self.expected_local_repo_path,
         single_branch=True,
         depth=2,
     )
     repo = fake_repo.return_value
     eq_(repo.git.submodule.called, False)
Ejemplo n.º 4
0
 def test_checkout_new_with_submodules(self, fake_repo, local_folder_exists,
                                       *_):
     local_folder_exists.return_value = False
     git_clone([self.require_with_submodule])
     fake_repo.clone_from.assert_called_with(
         self.repo,
         self.expected_local_repo_path,
         single_branch=True,
         depth=2,
     )
     repo = fake_repo.clone_from.return_value
     repo.git.submodule.assert_called_with("update", "--init")
Ejemplo n.º 5
0
 def test_git_update(self, fake_repo, local_folder_exists, *_):
     local_folder_exists.return_value = True
     git_clone([self.require])
     fake_repo.assert_called_with(self.expected_local_repo_path)
     repo = fake_repo.return_value
     repo.git.pull.assert_called()
Ejemplo n.º 6
0
 def test_update_existing_with_branch_parameter(self, fake_repo,
                                                local_folder_exists, *_):
     local_folder_exists.return_value = True
     git_clone([self.require_with_branch])
     repo = fake_repo.return_value
     repo.git.checkout.assert_called_with("ghpages")
Ejemplo n.º 7
0
 def test_update_existing_with_reference_parameter(self, fake_repo,
                                                   local_folder_exists, *_):
     local_folder_exists.return_value = True
     git_clone([self.require_with_reference])
     repo = fake_repo.return_value
     repo.git.checkout.assert_called_with("a-commit-reference")