test_log.py 文件源码

python
阅读 30 收藏 0 点赞 0 评论 0

项目:gitnet 作者: networks-lab 项目源码 文件源码
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)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号