test_wrapper.py 文件源码

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

项目:django-performance-testing 作者: PaesslerAG 项目源码 文件源码
def test_when_outer_enter_fails(self):
        ControllableContextManager.reset_events()
        outer = ControllableContextManager(fail_in_method='__enter__')
        inner = ControllableContextManager()

        with pytest.raises(ControllableContextManager.TestException):
            self.run_nested_context_managers(outer, inner)

        expected_calls = self.get_recorded_calls()
        assert expected_calls == [(outer, '__enter__')]

        ControllableContextManager.reset_events()
        with pytest.raises(ControllableContextManager.TestException):
            with multi_context_manager([outer, inner]):
                pass
        assert expected_calls == self.get_recorded_calls()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号