1.pip install pytest
2.打开pycharm配置的Tools标签页,修改default test runner
打开Pycharm的Preferences配置界面,搜索pytest,如下配置,如果没有安装pytest依赖,会有提示信息,点一下fix,安装依赖即可