1

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.

David Parks
  • 30,789
  • 47
  • 185
  • 328
  • 1
    Why this is not possible from `Edit Configurations` and then add whatever you want to parameters? – ndrwnaguib Jan 30 '19 at 22:19
  • I see `Additional Arguments` (arguments to the test case I believe), and `Interpreter options` (arguments to the python interpreter). But nothing there that lets me send arguments to pytest. Am I wrong? – David Parks Jan 31 '19 at 00:09
  • 1
    `Additional Arguments` are arguments for `pytest` indeed, try it out. – Pavel Karateev Feb 01 '19 at 07:58
  • Ah, thanks Pavel, you're right! I was misusing the argument and it made me think the arguments were not going to the right place. You should post that as an answer. – David Parks Feb 01 '19 at 23:10

2 Answers2

1

Answering on behalf of comments, indeed Additional Arguments in the Edit Configurations section does pass arguments through to py.test. My error was in misusing one of the arguments, obfuscating the fact that Additional Arguments was passing on the arguments as expected.

David Parks
  • 30,789
  • 47
  • 185
  • 328
-1

Edit Configuration -> Python tests -> Custom

Additional Arguments: --tb=1

M András
  • 29
  • 4