首页 > 解决方案 > In PyCharm, how do you add a custom parameter to pytest when running unittests?

问题描述

I'm running a Python unittest in pycharm. This executes the command:

/<path>/python /<path>/_jb_pytest_runner.py --target my_function_test_base.py::MyFunctionTestBase

Launching pytest with arguments my_function_test_base.py::MyFunctionTestBase in //tests

I would like to add a pytest option --tb=1 that I found in this answer: Make Python unittest show AssertionError but no Traceback

I don't know how to do that under PyCharm.

标签: pythonunit-testingpycharm

解决方案


代表评论回答,编辑配置部分中的附加参数确实将参数传递给py.test. Additional Arguments我的错误在于滥用其中一个论点,混淆了按预期传递论点的事实。


推荐阅读