Django、nose、coverage - 跳过某些模块
我正在 Django 应用程序上运行鼻子和覆盖范围。
我有一个看起来像这样的结构:
app
..__init__.py
..tests.py
..views.py
..models.py
..urls.py
..admin.py
现在,如果我运行正常的 manage.py 测试应用
,tests.py 中的测试运行不会出现问题。但是,当我将鼻子连接为测试套件时,测试停止运行(它找到并执行 0 个测试)。
这不是鼻子配置问题,因为我在其他类似结构的 django 应用程序上成功运行了完全相同的配置。
现在,如果我将 tests.py
文件更改为名为“tests”的目录,并将所有这些测试放入 __init__.py
中,则测试将使用鼻子运行。
更复杂的是,当这些测试确实作为 __init__ 文件运行时,覆盖率报告仅显示 admin.py
、__init__.py
上的覆盖率>,和 models.py
但它跳过 admin.py
和 views.py
。如上所述,这不是鼻子配置问题,因为我让该套件与其他结构类似的应用程序一起运行,并且它的性能符合预期。
有什么线索吗?说到这里,我已经把头撞到墙上了……
I'm running nose and coverage on a Django app.
I've got a structure that looks something like this:
app
..__init__.py
..tests.py
..views.py
..models.py
..urls.py
..admin.py
Now, if I run the normal manage.py test app
the tests in tests.py run without an issue. However, when I hook up nose as a test suite, the tests stop running (it finds and executes 0 tests).
This is not a nose configuration issue, as I have the exact same configuration running successfully on other, similarly structured django apps.
Now, if I take the tests.py
file and change it into a directory named "tests" and put all of those tests into __init__.py
, the tests run using nose.
To further complicate things, when those tests DO run as an __init__
file, the coverage report is only showing coverage on admin.py
, __init__.py
, and models.py
but it is skipping admin.py
and views.py
. As above, this is not a nose config issue, as I have the suite running inclusively with other, similarly structured apps and it's performing as expected.
Any clues? I'm banging my head against the wall on this one...
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您是否尝试过通过指定名为 --tests 的参数来强制 django_nose 运行某些测试?也许其中一些会起作用:
Have you tried forcing django_nose to run certain tests by specifying an argument called --tests? Maybe of of these will work: