How do I configure PyCharm to run py.test tests?

前端 未结 12 1345
闹比i
闹比i 2020-12-07 09:31

I want to start writing unit tests for my Python code, and the py.test framework sounds like a better bet than Python\'s bundled unittest. So I added a \"tests\" directory t

12条回答
  •  隐瞒了意图╮
    2020-12-07 10:10

    With a special Conda python setup which included the pip install for py.test plus usage of the Specs addin (option --spec) (for Rspec like nice test summary language), I had to do ;

    1.Edit the default py.test to include option= --spec , which means use the plugin: https://github.com/pchomik/pytest-spec

    2.Create new test configuration, using py.test. Change its python interpreter to use ~/anaconda/envs/ your choice of interpreters, eg py27 for my namings.

    3.Delete the 'unittests' test configuration.

    4.Now the default test config is py.test with my lovely Rspec style outputs. I love it! Thank you everyone!

    p.s. Jetbrains' doc on run/debug configs is here: https://www.jetbrains.com/help/pycharm/2016.1/run-debug-configuration-py-test.html?search=py.test

提交回复
热议问题