Dan*_*Dow 1 python pytest python-3.x
我一直在互联网上寻找答案。他们都告诉我要确保我完全按照你在下面看到的那样去做。实际上,我是在 Pytest 的在线课程中完成这一切的,但它不起作用。
ls
TestCheckout.py __init__.py __pycache__ pytest.ini
cat TestCheckout.py
def test_ConInstantiateCheckout():
co = CheckOut()
pytest
=================================================== test session starts ====================================================
platform darwin -- Python 3.7.4, pytest-5.2.0, py-1.8.0, pluggy-0.13.0
rootdir: /Users/ddow/dev/supermarket-kata
collected 0 items
================================================== no tests ran in 0.01s
Run Code Online (Sandbox Code Playgroud)
有谁知道什么给?任何帮助将不胜感激。
pytest遵循测试发现程序。您可以在此处查看详细信息。
对于您的特定情况,文件名应以 . 开头test_或结尾_test.py。所以重命名TestCheckout.py为就test_Checkout.py可以了。如果您不想更改名称,可以明确提供文件名,如下所示
user@qt01:~/folder$ pytest TestCheckout.py
============================================== test session starts ==============================================
platform linux -- Python 3.5.2, pytest-5.1.2, py-1.8.0, pluggy-0.12.0
sensitiveurl: .*
rootdir: /home/user/folder
plugins: needle-0.3.11, selenium-1.17.0, html-1.21.1, repeat-0.8.0, metadata-1.8.0, celery-4.3.0, base-url-1.4.1, variables-1.7.1
collected 1 item
TestCheckout.py . [100%]
=============================================== 1 passed in 0.03s ===============================================
user@qt01:~/folder$
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1511 次 |
| 最近记录: |