How to debug py.test in PyCharm when coverage is enabled

后端 未结 1 771
难免孤独
难免孤独 2021-02-18 23:37

How do I debug py.test in PyCharm when coverage is enabled?

Coverage is enabled using --cov=project --cov-report=term-missing, removing this and breakpoints

1条回答
  •  攒了一身酷
    2021-02-18 23:48

    There is now a flag in py.test to disable coverage which you can activate when running tests from PyCharm.

    The flag to use is --no-cov. If you want this to apply to all your test runs you can add this to the default pytest configuration as below:

    Extra tip: You probably also want a -s flag in there so output isn't swallowed by py.test. See https://stackoverflow.com/a/17810324/238166 for details.

    In case you receive an "unrecognized argument" error, you may need to install pytest-cov, e.g. by pip install pytest-cov.

    0 讨论(0)
提交回复
热议问题