会员
周边
新闻
博问
闪存
赞助商
YouClaw
所有博客
当前博客
我的博客
我的园子
账号设置
会员中心
简洁模式
...
退出登录
注册
登录
laibulali
博客园
首页
新随笔
联系
订阅
管理
2025年3月19日
pytest (十) conftext文件中的一些函数配置
摘要: def pytest_collection_modifyitems(items): """ 在console中ids是中文显示unicode码,下面将unicode改为utf-8 :return: """ for item in items: item.name = item.name.encode
阅读全文
posted @ 2025-03-19 22:23 アーニャ
阅读(17)
评论(0)
推荐(0)
2025年3月18日
pytest (九) mark 使用方法
摘要: import pytest @pytest.mark.sit def test_sit(): print('test_sit') @pytest.mark.uat def test_uat(): print('test_uat') pytest.main(['-m=sit']) # 结果如下 '''
阅读全文
posted @ 2025-03-18 23:16 アーニャ
阅读(35)
评论(0)
推荐(0)
pytest (八) request 使用方法
摘要: import pytest @pytest.fixture() def begin(request): print(request.param) @pytest.mark.parametrize('begin', ['python', 'java'], indirect=True) def test
阅读全文
posted @ 2025-03-18 23:12 アーニャ
阅读(34)
评论(0)
推荐(0)
pytest (七) parametrize 使用方法
摘要: import pytest @pytest.mark.parametrize('args', ['python', 'java']) def test_a(args): print(args) # 结果如下 ''' test_a python test_a java ''' import pytes
阅读全文
posted @ 2025-03-18 23:04 アーニャ
阅读(30)
评论(0)
推荐(0)
2025年3月17日
pytest (六) fixture ids参数使用
摘要: # ids就是给每个测试用例取了名 import pytest @pytest.fixture(params=['100', '90'], ids=['张三', '李四']) def begin(request): return request.param def test_a(begin): pr
阅读全文
posted @ 2025-03-17 22:44 アーニャ
阅读(28)
评论(0)
推荐(0)
pytest (五) fixture name参数使用
摘要: import pytest @pytest.fixture(name='start') def begin(): print('执行 begin') # 由于上面的fixture使用了name的参数,把begin改了名,名为start,所有传start def test_a(start): prin
阅读全文
posted @ 2025-03-17 22:37 アーニャ
阅读(24)
评论(0)
推荐(0)
pytest (四) fixture params参数使用
摘要: import pytest @pytest.fixture(params=['python', 'java']) def begin(request): return request.param def test_a(begin): print(begin) # 结果如下 ''' test_a[py
阅读全文
posted @ 2025-03-17 22:32 アーニャ
阅读(73)
评论(0)
推荐(0)
pytest (三) fixture autouse参数使用
摘要: # autouse 默认是False import pytest @pytest.fixture(autouse=False) def begin(): print('执行 begin') # autouse是False,则需要在测试用例中加入参数begin def test_a(begin): p
阅读全文
posted @ 2025-03-17 22:21 アーニャ
阅读(75)
评论(0)
推荐(0)
pytest (二) fixture scope参数使用
摘要: fixture参数如下 param scope:function(默认), class, module, session, package function的作用域在每个测试用例都执行一次 class的作用域在每个类下只执行一次 module的作用域在每个py文件下只执行一次 session的作用域
阅读全文
posted @ 2025-03-17 22:15 アーニャ
阅读(48)
评论(0)
推荐(0)
pytest (一) fixture 简单使用
摘要: import pytest # fixture默认参数function @pytest.fixture() def begin(): print('执行 test_a') # 参数传入 begin def test_b(begin): print('执行 test_b') 执行 begin 执行 t
阅读全文
posted @ 2025-03-17 21:42 アーニャ
阅读(20)
评论(0)
推荐(0)
下一页
公告