如果我有这两份文件:def add(a, b): >>> add(1, 2) # should this not fail first?/second_module.py:6: DocTestFailure
但是,我实际上希望第一个测试会首先失败,因为add需要具有功能才能使anti_add正常工作。我有时会感到困惑,因为anti_add测试因为add中的一个错误而失败,但是我在add中没有看到失败,所以我假设它可以正常工作。
我刚开始进行pytest,并尝试运行一个简单的测试来检查pytest是否有效。我使用的是windows 10、python 3.8.5和pytest 6.0.1。test_sample.py中添加的内容: return x + 1
assert func(3) == 5> pytestthe test run fine (1 failed in
我用pytest编写了测试,并使用pytest命令运行它们。我看了看其他的pytest模块,然后遇到了pytest-runner。这到底是干什么用的?
模块的描述如下,请解释..。Setup scripts can use pytest-runner to add setup.py test support for pytest runner.