pytest 的多种运行模式
- 单独执行某个 Python 文件:
pytest 文件.py - 单独执行某个文件中的某个类
pytest 文件.py::类名 - 单独执行某个文件中某个类的某个方法
pytest 文件.py::类名::方法名
在pycharm中运行pytest用例
Pycharm–>File–>settings–>Tools–>Python Integrated Tools–>Testing Default test runner 选择 pytest
设置好之后,用例的左侧会有绿色箭头,可以通过点击箭头来运行此用例
![在这里插入图片描述](https://img-blog.csdnimg.cn/20201208215349721.png)