添加链接
link管理
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接
相关文章推荐
英姿勃勃的火柴  ·  PEP 0 – Index of ...·  2 天前    · 
开朗的茄子  ·  Spark - RCC User Guide·  昨天    · 
儒雅的豌豆  ·  python 类 属性 ...·  5 小时前    · 
瘦瘦的打火机  ·  Web Application ...·  3 月前    · 
爱旅游的汽水  ·  RealTime Glo Annexin ...·  6 月前    · 
坏坏的斑马  ·  编程开发 - 宝哥软件园·  9 月前    · 
想出国的碗  ·  Search by category ...·  1 年前    · 
Collectives™ on Stack Overflow

Find centralized, trusted content and collaborate around the technologies you use most.

Learn more about Collectives

Teams

Q&A for work

Connect and share knowledge within a single location that is structured and easy to search.

Learn more about Teams

Using coverage with pytests is a very useful tool.

Html reporting allows for nice output, however through command line, can't find an option to modify the default output directory (htmlcov)

example command line:

python -m pytest lib_being_tested\tests --cov lib_being_tested.module --cov-report=html

now (3 years later) you can change the default output directory directly in command line:

python -m pytest --cov --cov-report=html:reports/html_dir --cov-report=xml:reports/coverage.xml lib_being_tested.module

Missing directories are created on the fly

Simeon's answer is still relevant to choose this output directory through coverage configuration file

This configuration option isn't part of pytest-cov.

In the configuration file for the underlying tool coverage.py, which is called .coveragerc by default, you can add:

[html]
directory = differentname

See the documentation for details: https://github.com/nedbat/coveragepy/blob/master/doc/config.rst

The docs are also available at their canonical location: nedbatchelder.com/code/coverage/config.html – Ned Batchelder Dec 18, 2014 at 19:33

Thanks for contributing an answer to Stack Overflow!

  • Please be sure to answer the question. Provide details and share your research!

But avoid

  • Asking for help, clarification, or responding to other answers.
  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.