Can I restrict nose coverage output to directory (rather than package)?

前端 未结 8 2021
-上瘾入骨i
-上瘾入骨i 2021-02-05 08:45

My SUT looks like:

foo.py
bar.py
tests/__init__.py [empty]
tests/foo_tests.py
tests/bar_tests.py
tests/integration/__init__.py [empty]
tests/integration/foo_test         


        
8条回答
  •  广开言路
    2021-02-05 09:00

    I would do this:

    nosetests --with-coverage --cover-package=foo,bar tests/*
    

    I prefer this solution to the others suggested; it's simple yet you are explicit about which packages you wish to have coverage for. Nadia's answer involves a lot more redundant typing, Stuart's answer uses sed and still creates a package by invoking touch __init__.py, and --cover-package=. doesn't work for me.

提交回复
热议问题