-
Notifications
You must be signed in to change notification settings - Fork 2
/
conftest.py
49 lines (35 loc) · 1.17 KB
/
conftest.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# -*- coding: utf-8 -*-
# @Time : 2021/04/18 21:16:36
# @Author : DannyDong
# @File : conftest.py
# @Describe: None
import pytest
# 动态添加命令行参数
def pytest_addoption(parser):
parser.addoption("--device", action="store",
default="type1", help="my option: type1 or type2")
parser.addoption("--wx", action="store", default="0",
help="my option: 0 or 1")
parser.addoption("--deviceType", action="store", default="android",
help="android or ios")
# 获取DeviceInfo
@pytest.fixture(scope='session')
def device(request):
return request.config.getoption("--device")
# 获取DeviceType
@pytest.fixture(scope='session')
def device_type(request):
return request.config.getoption("--deviceType")
# 是否重启微信
@pytest.fixture(scope='session')
def is_wx(request):
return request.config.getoption("--wx")
# 获取用例Mark
@pytest.fixture(scope='session')
def get_mark(request):
return request.config.option.markexpr
# 动态注册Mark
def pytest_configure(config):
config.addinivalue_line("markers", 'Test01_获取微信信息')
if __name__ == '__main__':
pass