pytest没有给出详细的失败报告

时间:2019-03-12 14:27:16

标签: python unit-testing pytest

在我的文件test_stochastic.py中,我有以下功能失败

    def test_FishersNCHyp(self):
        N = 20
        m1 = 8
        m2 = N - m1
        n = 5
        odds = 0.1

        result = self.stoc3.FishersNCHyp(n, m1, N, odds)
        result_min = max(0, N - m2)
        result_max = min(n, m1)
        assert result >= result_min and result <= result_max

当我在相关目录下运行pytest时,我只有tests/test_stochastic.py .........F。使用pytest -v,可以得到更多信息

...
tests/test_stochastic.py::TestStoc1::test_Shuffle PASSED    [ 64%]
tests/test_stochastic.py::TestStoc3::test_FishersNCHyp FAILED [ 71%]

即使我做了pytest --maxfail=10,似乎pytest在第一次失败后也会停止。 pytest如何返回详细的失败报告,以显示断言如何失败?

0 个答案:

没有答案