【发布时间】:2019-06-24 07:27:34
【问题描述】:
我正在 pycharm 中运行 Python 单元测试。这会执行命令:
/<path>/python /<path>/_jb_pytest_runner.py --target my_function_test_base.py::MyFunctionTestBase
在 //tests 中使用参数 my_function_test_base.py::MyFunctionTestBase 启动 pytest
我想添加我在此答案中找到的 pytest 选项 --tb=1:Make Python unittest show AssertionError but no Traceback
我不知道如何在 PyCharm 下做到这一点。
【问题讨论】:
-
为什么这是不可能的
Edit Configurations然后添加任何你想要的参数? -
我看到
Additional Arguments(我相信的测试用例的参数)和Interpreter options(python 解释器的参数)。但是那里没有任何东西可以让我向 pytest 发送参数。我错了吗? -
Additional Arguments确实是pytest的参数,试一试。 -
啊,谢谢帕维尔,你说得对!我滥用了这个论点,这让我认为这些论点没有出现在正确的地方。您应该将其发布为答案。
标签: python unit-testing pycharm