Exemplo n.º 1
0
 def test_git_get_info(self):
     repo = os.path.join(self.tempdir_name, "test_repo")
     git_dep = dv.GITDependency(
         name="test_repo",
         version_info={
             "repository": repo,
             "branch": "master",
             "version": "395c738b6aa8b7074d7d2e533c95276cc0990876"
         })
     git_dep = dv.GITDependency(name="test_repo",
                                version_info={
                                    "repository": repo,
                                    "branch": "master"
                                })
     git_dep.update()
     self.assertDictEqual(
         git_dep.get_present_info(), {
             "type": "git",
             "repository": repo,
             "branch": "master",
             "version": "4cc3b223d2997c8bbf84bfeae420b0d1e4dad732"
         })
     self.assertDictEqual(
         git_dep, {
             "type": "git",
             "repository": repo,
             "branch": "master",
             "version": "4cc3b223d2997c8bbf84bfeae420b0d1e4dad732"
         })
Exemplo n.º 2
0
 def test_git_update(self):
     git_dep = dv.GITDependency(name="test_repo",
                                version_info={
                                    "repository":
                                    os.path.join(self.tempdir_name,
                                                 "test_repo"),
                                    "branch":
                                    "master"
                                })
     git_dep.update()
     self.assertEqual(git_dep.get_present_version(),
                      "4cc3b223d2997c8bbf84bfeae420b0d1e4dad732")
     (stdout,
      stderr) = subprocess.Popen("cd test_repo && git reset --hard HEAD^",
                                 shell=True,
                                 universal_newlines=True).communicate()
     self.assertEqual(git_dep.get_present_version(),
                      "395c738b6aa8b7074d7d2e533c95276cc0990876")
     git_dep = dv.GITDependency(name="test_repo",
                                version_info={
                                    "repository":
                                    os.path.join(self.tempdir_name,
                                                 "test_repo"),
                                    "branch":
                                    "master"
                                })
     git_dep.update()
     self.assertEqual(git_dep.get_present_version(),
                      "4cc3b223d2997c8bbf84bfeae420b0d1e4dad732")
Exemplo n.º 3
0
 def test_git_change_branch(self):
     git_dep = dv.GITDependency(name="test_repo",
                                version_info={
                                    "repository":
                                    os.path.join(self.tempdir_name,
                                                 "test_repo"),
                                    "branch":
                                    "master"
                                })
     git_dep.update()
     self.assertEqual(git_dep.get_present_version(),
                      "4cc3b223d2997c8bbf84bfeae420b0d1e4dad732")
     git_dep = dv.GITDependency(name="test_repo",
                                version_info={
                                    "repository":
                                    os.path.join(self.tempdir_name,
                                                 "test_repo"),
                                    "branch":
                                    "dev"
                                })
     git_dep.update()
     self.assertEqual(git_dep.get_present_version(),
                      "238aacacf8d4c0a73f3395912c5114763fa195ab")
Exemplo n.º 4
0
 def test_git_clone(self):
     try:
         (stdout,
          stderr) = subprocess.Popen("rm -fr test_repo",
                                     shell=True,
                                     universal_newlines=True).communicate()
     except:
         pass
     git_dep = dv.GITDependency(name="test_repo",
                                version_info={
                                    "repository":
                                    os.path.join(self.tempdir_name,
                                                 "test_repo"),
                                    "branch":
                                    "master"
                                })
     git_dep.update()
     branch = git_dep.get_current_branch()
     self.assertEqual(branch, "master")