![](https://i-blog.csdnimg.cn/columns/default/20201014180756919.png?x-oss-process=image/resize,m_fixed,h_224,w_224)
test
文章平均质量分 74
时光不写代码
高级菜鸟努力飞
展开
-
pytest基础教程
安装pip install pytest验证版本pytest --version使用def f(a): return a + 1def tests_f(): # 断言 assert func(1) == 2执行执行shell命令pytestdjango 使用安装pip install pytest-django使用在Django项目的根目录,也就是和manage.py同一级,创建配置文件pytest.ini。[pytest]DJANGO_S原创 2022-01-20 17:23:47 · 921 阅读 · 0 评论 -
pytest mock的使用
简单使用return_value返回固定的数据方法一,使用装饰器。import mockdef add(a, b): return a + b# 使用mock的return_value参数改变add返回的数据@mock.patch('add', return_value=10)def test_add(): print(add(1, 2)) # 10方法二,使用mock.path方法。import mockdef test_add(): with mock.原创 2020-12-30 22:58:52 · 1461 阅读 · 0 评论 -
ab压力测试(入门)
ab压力测试(入门)记录一下最近了解的压力测试工具 ab 全称: apache bench测试命令:ab -c 1000 -n 100 -p data.txt -T application/json -H "token:xxx" -w "http://127.0.0.1/test/" >> test.html-c: 请求数量-n: 请求并发量-p: 请求参数文件-...原创 2019-02-14 11:40:45 · 580 阅读 · 0 评论