test_resultlog.py 文件源码

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

项目:GSM-scanner 作者: yosriayed 项目源码 文件源码
def test_failure_issue380(testdir):
    testdir.makeconftest("""
        import pytest
        class MyCollector(pytest.File):
            def collect(self):
                raise ValueError()
            def repr_failure(self, excinfo):
                return "somestring"
        def pytest_collect_file(path, parent):
            return MyCollector(parent=parent, fspath=path)
    """)
    testdir.makepyfile("""
        def test_func():
            pass
    """)
    result = testdir.runpytest("--resultlog=log")
    assert result.ret == 1
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号