collect.py 文件源码

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

项目:GSM-scanner 作者: yosriayed 项目源码 文件源码
def test_customized_pymakeitem(self, testdir):
        b = testdir.mkdir("a").mkdir("b")
        b.join("conftest.py").write(py.code.Source("""
            import pytest
            @pytest.hookimpl(hookwrapper=True)
            def pytest_pycollect_makeitem():
                outcome = yield
                if outcome.excinfo is None:
                    result = outcome.result
                    if result:
                        for func in result:
                            func._some123 = "world"
        """))
        b.join("test_module.py").write(py.code.Source("""
            import pytest

            @pytest.fixture()
            def obj(request):
                return request.node._some123
            def test_hello(obj):
                assert obj == "world"
        """))
        reprec = testdir.inline_run()
        reprec.assertoutcome(passed=1)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号