Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is nose an extension of unittest?

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?

like image 633
user1040625 Avatar asked Nov 22 '11 14:11

user1040625


2 Answers

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).

like image 166
mac Avatar answered Oct 11 '22 13:10

mac


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.

like image 41
gecco Avatar answered Oct 11 '22 14:10

gecco