簡體   English   中英

我如何讓pytest運行所有功能作為測試

[英]How do I get pytest to run all functions as test

我環顧四周,找不到pytest.ini標志傳遞,該標志表示

def test_one():
   # you run this by default

def two():
   # despite not having test in the name you should also run this

原因:當我使用命名進行描述時,測試功能名稱的長度越來越長,坦率地說,它似乎很干燥。

文檔

# content of setup.cfg
# can also be defined in in tox.ini or pytest.ini file
[pytest]
python_files=check_*.py
python_classes=Check
python_functions=*_check

替換*_check只有*在那里,你設置。

嘗試如下所示,它將要求所有python文件進行py.test集合測試。

# content of pytest.ini
[pytest]
python_files = *.py

您可以檢查文檔的這一部分,

自定義測試集合以查找所有.py文件

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM