Beispiel #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")
Beispiel #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)
Beispiel #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)
Beispiel #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")
Beispiel #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()
Beispiel #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")
Beispiel #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")