pytest用例规则
- 测试文件以test_开头(以_test结尾也可以)
- 测试类以Test开头,并且不能带有 init 方法
- 测试函数以test_开头
- 断言使用assert
pytest用例设计原则
- 文件名以test_.py文件和_test.py
- 以test_开头的函数
- 以Test开头的类
- 以test_开头的方法
- 所有的包pakege必须要有__init__.py文件
help帮助
1.查看pytest命令行参数,可以用pytest -h 或pytest --help查看
以下为项目目录
/Users/****/PycharmProjects/pytest200827\
__init__.py
test_class.py
# content of test_class.py
class TestClass:
def