Assert that RuntimeErrors have correct messages

This commit is contained in:
Evan Goode 2019-06-24 13:55:38 -04:00 committed by Brian C. Lane
parent fef76930bc
commit 998d0140be
1 changed files with 4 additions and 2 deletions

View File

@ -111,9 +111,10 @@ class GitArchiveTest(unittest.TestCase):
ref="v1.1.0"
destination="/srv/testing-rpm/"
""" % ("/tmp/no-repo-here/"))
with self.assertRaises(RuntimeError):
with self.assertRaises(RuntimeError) as e:
archive = GitArchiveTarball(git_repo["repos"]["git"][0])
self._check_tar(archive, "git-rpm-test/", None)
self.assertIn("Failed to clone", str(e.exception))
def git_fail_ref_test(self):
"""Test creating an archive from a bad ref"""
@ -127,9 +128,10 @@ class GitArchiveTest(unittest.TestCase):
ref="0297617d7b8baa263a69ae7dc901bbbcefd0eaa4"
destination="/srv/testing-rpm/"
""" % (self.repodir))
with self.assertRaises(RuntimeError):
with self.assertRaises(RuntimeError) as e:
archive = GitArchiveTarball(git_repo["repos"]["git"][0])
self._check_tar(archive, "git-rpm-test/", None)
self.assertIn("Failed to archive", str(e.exception))
class GitRpmTest(unittest.TestCase):