test_detox.py 文件源码

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

项目:detox 作者: tox-dev 项目源码 文件源码
def test_runtestmulti(self):
        class MyConfig:
            class MyOption:
                numproc = 7
            option = MyOption()

        l = []

        def MyGreenPool(**kw):
            l.append(kw)
            # Building a Detox object will already call GreenPool(),
            # so we have to let MyGreenPool being called twice before raise
            if len(l) == 2:
                raise ValueError

        from detox import proc
        setattr(proc, 'GreenPool', MyGreenPool)
        with pytest.raises(ValueError):
            d = proc.Detox(MyConfig())
            d.runtestsmulti(['env1', 'env2', 'env3'])  # Fake env list

        assert l[0] == {}  # When building Detox object
        assert l[1] == {'size': 7}  # When calling runtestsmulti
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号