方式一:

  在terminal页通过 python -m pytest xxx.py 执行脚本

 

方式二:

  在命令行窗口执行,如:pytest -s test_game.py -m=abc  注意:m=abc为test_game.py中定义的方法

 

方法三:

  在python代码本身里执行,同时需要

  1、把命令写到main语句块中    2、在pytest后面加上.main    3、把参数、文件名称用引号引起来 

  如:pytest.main(["-s","test_game.py","-m=abc"])

 

相关文章:

  • 2021-07-09
  • 2021-09-05
  • 2022-01-01
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-07-16
猜你喜欢
  • 2021-10-11
  • 2021-08-28
  • 2022-01-10
  • 2021-11-15
  • 2022-12-23
  • 2021-08-06
  • 2021-10-05
相关资源
相似解决方案