- 命名规范
默认情况下:
类名:
必须以Test开头
方法名:
必须以test_开头
2.自定义 执行顺序
通过注解 @pytest.mark.run(order=x)
import pytest
class Test_Rule:
def test_one(self):
assert 1==1
@pytest.mark.run(order =2)
def test_one(self):
assert 1==2
注意:
需要安装插件,不然运行时会有警告:pytest_ordering插件
4. 常见断言
大于>、<、!=、in、not in
5.pytest.ini配置项
[pytest] #固定写法
testpaths=./
testpaths=./test_cases