[PyCharm]pytest设置和使用

PyTest使用参考pytest

设置

点击菜单栏 -> File -> Settings,选择Tools->Python Integrated Tools,在Testing选项中选择pytest

使用

编辑测试文件后,在编辑区域右键选择Run "pytest for xxx"

如果不存在,需要额外创建运行配置,点击Edit Configuration

点击左上角+符号,创建一个新的配置

  1. 选择pytest作为执行命令
  2. 选择要执行的文件路径