def test_warnings(self):
"""Are warnings printed at the right time?"""
# Setting up a more complicated repository
sub.call(["rm", "-rf", ".git"])
sub.call(["cp", "-R", "repo_nx.git", ".git"])
path = os.getcwd()
nx_log = gitnet.get_log(path)
# Note: Depending on the environment a warning may or may not be raised. For example, PyCharm uses UTF-8
# encoding and thus will not raised the unicode error.
with warnings.catch_warnings(record=True) as w:
# Ensure warnings are being shown
warnings.simplefilter("always")
# Trigger Warning
nx_log.detect_dup_emails()
# Check warning occurs
self.assertTrue(len(w) == 0 or len(w) == 1)
评论列表
文章目录