In PyCharm, how do you add a custom parameter to pytest when running unittests?

Question:

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.

Asked By: David Parks

||

Answers:

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.

Answered By: David Parks

Edit Configuration -> Python tests -> Custom

Additional Arguments: –tb=1

Answered By: M András
Categories: questions Tags: , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.