简体   繁体   English

pytest详细输出说明

[英]pytest verbose output explanation

I am using pytest-django to run unit tests I made. 我正在使用pytest-django运行我进行的单元测试。 When I use the -v flag I get an output like: 当我使用-v标志时,我得到如下输出:

dashboard/apps/excel_import/tests.py::ExcelImportTestCase::test_multiple_excel PASSED [ 50%]
dashboard/apps/excel_import/tests.py::ExcelImportTestCase::test_specific_excel PASSED [100%]

I can't find in the pytest docs, or anywhere else on google, what the PASSED [ 50%] means. 我在pytest文档中或Google的其他任何地方都找不到PASSED [ 50%]含义。 I have 4 asserts in that specific test, does it mean I passed 2 and failed 2? 在该特定测试中,我有4条断言,这是否意味着我通过了2次而未通过2次? if so then why doesn't it tell me I failed some tests? 如果是这样,那为什么不告诉我我未通过某些测试?

I don't know if this is relevant but I am also using python-cov for code coverage. 我不知道这是否相关,但我也在使用python-cov进行代码覆盖。 The code coverage results claim 100% of that file is being run, so it doesn't seem like only half the tests were run or something of the sort. 代码覆盖率结果声称该文件的100%正在运行,因此似乎并不是只有一半的测试在运行或某种程度的测试。

If anyone know what the PASSED [ 50%] means I will be very grateful for the insight. 如果有人知道PASSED [ 50%]含义,我将非常感谢您的见解。 Thanks in advance for any help available! 预先感谢您提供的任何帮助!

" PASSED " means the listed test passed. PASSED ”表示已通过列出的测试。 [ 50%] is how many of the tests have been run so far. [ 50%]是到目前为止已经运行了多少测试。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM