test_facade.py 文件源码

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

项目:landscape-client 作者: CanonicalLtd 项目源码 文件源码
def test_perform_changes_dpkg_error_retains_excepthook(self):
        """
        We install a special excepthook when preforming package
        operations, to prevent Apport from generating crash reports when
        dpkg returns a failure. It's only installed when doing the
        actual package operation, so the original excepthook is there
        after the perform_changes() method returns.
        """
        old_excepthook = sys.excepthook
        self._add_system_package("foo")
        self.facade.reload_channels()
        foo = self.facade.get_packages_by_name("foo")[0]
        self.facade.mark_remove(foo)
        with self.assertRaises(TransactionError):
            self.facade.perform_changes()
        self.assertIs(old_excepthook, sys.excepthook)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号