是否可以将鼻子覆盖范围输出限制在目录(而不是程序包)上? [英] Can I restrict nose coverage output to directory (rather than package)?

查看:62
本文介绍了是否可以将鼻子覆盖范围输出限制在目录(而不是程序包)上?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的SUT看起来像:

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

当我运行nosetests --with-coverage时,我会获得有关以下各项的详细信息 我宁愿忽略的模块.但我不能使用 --cover-package=PACKAGE选项,因为foo.py& bar.py不在 包裹. (请参阅之后的主题 http://lists.idyll.org/pipermail/testing -in-python/2008-November/001091.html 由于我的原因而不是将它们放在包装中.)

When I run nosetests --with-coverage, I get details for all sorts of modules that I'd rather ignore. But I can't use the --cover-package=PACKAGE option because foo.py & bar.py are not in a package. (See the thread after http://lists.idyll.org/pipermail/testing-in-python/2008-November/001091.html for my reasons for not putting them in a package.)

我可以将coverage输出限制为foo.py&吗? bar.py?

Can I restrict coverage output to just foo.py & bar.py?

更新-假设没有比以下 Nadia 更好的答案了,我问了一个后续问题:

Update - Assuming that there isn't a better answer than Nadia's below, I've asked a follow up question: "How do I write some (bash) shell script to convert all matching filenames in directory to command-line options?"

推荐答案

您可以像这样使用它:

--cover-package=foo --cover-package=bar

我快速查看了鼻子源代码以确认:

I had a quick look at nose source code to confirm: This is the line

    if options.cover_packages:
        for pkgs in [tolist(x) for x in options.cover_packages]:

这篇关于是否可以将鼻子覆盖范围输出限制在目录(而不是程序包)上?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆