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)
评论列表
文章目录