
pytest
测试用例的识别与运行
测试文件:test_*.py 和 *_test.py 以test开头或结尾的文件
测试用例:Test*类包含的所有 test_*的方法(测试类不能带有__init__方法), 不在class中的所有test_*的方法
python
def func(x):
return x + 1
def test_answer():
assert func(3) == 5

python执行
python
import pytest
def func(x):
return x + 1
def test_answer():
assert func(3) == 5
#用python方式执行
if __name__ == "__main__":
pytest.main(["test_pytest.py"])
资料获取方法
【留言777】


各位想获取源码等教程资料的朋友请 点赞 + 评论 + 收藏 ,三连!
三连之后我会在评论区挨个私信发给你们~