test_coordinator.py 文件源码

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

项目:charm-helpers 作者: juju 项目源码 文件源码
def setUp(self):
        del hookenv._atstart[:]
        del hookenv._atexit[:]
        hookenv.cache.clear()
        coordinator.Singleton._instances.clear()

        def install(patch):
            patch.start()
            self.addCleanup(patch.stop)

        install(patch.object(hookenv, 'local_unit', return_value='foo/1'))
        install(patch.object(hookenv, 'is_leader', return_value=False))
        install(patch.object(hookenv, 'metadata',
                             return_value={'peers': {'cluster': None}}))
        install(patch.object(hookenv, 'log'))

        # Ensure _timestamp always increases.
        install(patch.object(coordinator, '_utcnow',
                             side_effect=self._utcnow))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号