鼻子是单元测试的扩展吗?

发布于 2024-12-17 13:50:20 字数 253 浏览 0 评论 0原文

我将使用鼻子作为在我相当大的项目中已经实现的单元测试类上进行测试发现的方法。我的印象是,nose 主要用于测试发现和测试运行(也可以并行)。但我看到这个问题就好像nose是unittest的替代品。有人可以澄清他们在这里的意思吗?我是否缺少鼻子提供的一些核心功能?

顺便说一句,py.test 和鼻子有什么区别?

I'm about to use nose as a method for test discovery on my already implemented unittest classes in my rather large project. I was under the impression that nose is just used primarily for test discovery and test running (in parallel as well). But I see this question as if nose is a replacement for unittest. Can someone clarify what they meant here? Am I missing some core piece of functionality that nose provides?

As a side note, what is the difference between py.test and nose?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

流殇 2024-12-24 13:50:20

鼻子的文档说:

nose 提供备用测试发现和运行流程
unittest,旨在模仿 py.test 的行为
在不诉诸太多魔法的情况下尽可能合理地进行。

如果您看一下代码,你会看到unittest是依赖项之一。

import logging
import sys
import unittest

因此,据我所知,nose 是运行测试的一种替代方案,但不能替代unittest 模块(这里稍微涉及一下语义,但我希望这足够清楚)。

The docs for nose say:

nose provides an alternate test discovery and running process for
unittest, one that is intended to mimic the behavior of py.test as
much as is reasonably possible without resorting to too much magic.

If you take a peek at the code, you will see that unittest is one of the dependencies.

import logging
import sys
import unittest

So - to the best of my knowledge - I would say that nose is a drop-in alternative for running tests, but not an replacement to the unittest module (playing a bit with the semantics here, but I hope this is clear enough).

素染倾城色 2024-12-24 13:50:20

Nose 模仿 py.test 的行为。他们在网站上是这么说的:

nose 为 unittest 提供了另一种测试发现和运行过程,旨在尽可能合理地模仿 py.test 的行为,而无需诉诸太多魔法

Nose是unittest的扩展添加问题 https://stackoverflow.com/questions/5696884/python-nose-vs-unittest

Nose mimics behavior of py.test. That's what they say on their website:

nose provides an alternate test discovery and running process for unittest, one that is intended to mimic the behavior of py.test as much as is reasonably possible without resorting to too much magic

Nose is an extension of unittest and adds the features listed in issue https://stackoverflow.com/questions/5696884/python-nose-vs-unittest.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文