2024-04-19 23:01:46 发布
网友
我们目前有pytest,覆盖率插件运行在tests目录中的测试上
pytest
tests
运行从主代码中提取的doctest最简单的方法是什么--doctest-modules不起作用(可能是因为它只是从tests运行doctest)。请注意,我们希望在同一进程中包含doctest(而不是简单地运行单独的py.test调用),因为我们希望在代码覆盖率中考虑doctest
--doctest-modules
py.test
您可以尝试使用pytest的repo版本并粘贴会话日志吗?我认为--doctest-modules应该能够获取任何.py文件
现在实现了:-)
要使用,请运行py.test --doctest-modules命令,或使用pytest.ini设置配置:
py.test --doctest-modules
pytest.ini
$ cat pytest.ini # content of pytest.ini [pytest] addopts = --doctest-modules
手册页:PyTest: doctest integration for modules and test files.
在一个模块中使用doctest和普通测试。对于要拾取的非doctest测试,标准py.test发现机制适用:带有测试前缀的模块名称,带有测试前缀的测试函数
您可以尝试使用pytest的repo版本并粘贴会话日志吗?我认为
--doctest-modules
应该能够获取任何.py文件现在实现了:-)
要使用,请运行
py.test --doctest-modules
命令,或使用pytest.ini
设置配置:手册页:PyTest: doctest integration for modules and test files.
在一个模块中使用doctest和普通测试。对于要拾取的非doctest测试,标准py.test发现机制适用:带有测试前缀的模块名称,带有测试前缀的测试函数
相关问题 更多 >
编程相关推荐