如何让pytest在定义test_suite()时尊重它?

2024-09-28 01:26:17 发布

您现在位置:Python中文网/ 问答频道 /正文

我试图通过pytest获取testfixtures的测试,但是有些测试模块使用old pattern来定义一个名为test_suite的函数,该函数返回测试:

def test_suite():
    return TestSuite((
        DocTestSuite(setUp=setUp, tearDown=tearDown),
        makeSuite(LogCaptureTests),
        ))

当pytest尝试收集此信息时,它失败并抱怨:

^{pr2}$

我怎么能让它来收集测试呢?在


Tags: 模块函数testreturn定义pytestdefsetup

热门问题