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

前端 未结 12 1381
闹比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:09

    I'm using 2018.2

    I do Run -> Edit Configurations... Then click the + in the upper left of the modal dialog. Select "python tests" -> py.test Then I give it a name like "All test with py.test"

    I select Target: module name and put in the module where my tests are (that is 'tests' for me) or the module where all my code is if my tests are mixed in with my code. This was tripping me up.

    I set the Python interpreter.

    I set the working directory to the project directory.

提交回复
热议问题