Python 您如何配置 PyCharm 以使用 -s 等命令行选项运行 py.test?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/27868516/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-19 02:22:49  来源:igfitidea点击:

How do you configure PyCharm to run py.test with command-line options like -s?

pythonpycharmpytest

提问by Jason S

I figured out how to run py.test files from PyCharm:

我想出了如何从 PyCharm 运行 py.test 文件:

  • Run/Debug configurations
  • in the Python tests category, click the "+" button to add a new configuration
  • choose py.test
  • enter the full path for the Target script and the working directory
  • 运行/调试配置
  • 在 Python 测试类别中,单击“+”按钮添加新配置
  • 选择 py.test
  • 输入目标脚本的完整路径和工作目录

but I can't seem to add the -soption to allow my test script to run with standard output not captured and hidden. (I tried -sunder interpreter options but it appears not to do anything.)

但我似乎无法添加-s选项以允许我的测试脚本以未捕获和隐藏的标准输出运行。(我-s在解释器选项下尝试过,但似乎没有做任何事情。)

How can I enable -s?

我怎样才能启用-s

采纳答案by Jason S

D'oh, I figured it out after all:

D'oh,毕竟我想通了:

enter image description here

在此处输入图片说明

You add it in the py.tests Options area of the Run/Edit configuration dialog.

您将它添加到运行/编辑配置对话框的 py.tests 选项区域中。