Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

test get_upstream_commit

  • Loading branch information...
commit b0d300798574e7c300d024ccf84fb12d7afd9b7b 1 parent 382122d
Ionuț Arțăriși authored
Showing with 6 additions and 0 deletions.
  1. +2 −0  git_tarballs
  2. +4 −0 test_git_tarballs.py
2  git_tarballs
View
@@ -41,6 +41,7 @@ def download_tarball(url, filename):
def get_changelog_from_tarball(tar_name):
+ """Get the ChangeLog file form the tarball as a string"""
try:
tar = tarfile.open(tar_name)
changelog_file = next(f for f in tar.getnames()
@@ -79,6 +80,7 @@ def get_parent_dir_and_version_from_tarball(tar_name, version_regexp):
def get_upstream_commit(changelog):
+ """Get the latest commit in the upstream git repository as a string"""
try:
return re.search(r'^commit (.*?)$', changelog, re.MULTILINE).group(1)
except AttributeError:
4 test_git_tarballs.py
View
@@ -76,6 +76,10 @@ def test_version_parse_comment(self):
self.assertEqual('0c8c2a3',
ghb.get_commit_from_spec('example_pkg'))
+ def test_get_upstream_commit(self):
+ self.assertEqual('921b7c514fb79bd4b8a023f34d22df4efe5406ad',
+ ghb.get_upstream_commit(CHANGELOG))
+
def test_parse_changelog(self):
self.assertEqual(
[('921b7c514fb79bd4b8a023f34d22df4efe5406ad',
Please sign in to comment.
Something went wrong with that request. Please try again.