Skip to main content

unittest2 with plugins, the succesor to nose

Project description status build status Documentation Latest PyPI version Supported Python Versions Join

Welcome to nose2

nose2 is the successor to nose.

It’s unittest with plugins.

nose2 is a new project and does not support all of the features of nose. See differences for a thorough rundown.

nose2’s purpose is to extend unittest to make testing nicer and easier to understand.

nose2 vs pytest

nose2 may or may not be a good fit for your project.

If you are new to python testing, we encourage you to also consider pytest, a popular testing framework.


Because nose2 is based on unittest, you can start from the Python Standard Library’s documentation for unittest and then use nose2 to add value on top of that.

nose2 looks for tests in python files whose names start with test and runs every test function it discovers.

Here’s an example of a simple test, written in typical unittest style:

# in
import unittest

class TestStrings(unittest.TestCase):
    def test_upper(self):
        self.assertEqual("spam".upper(), "SPAM")

You can then run this test like so:

$ nose2 -v
test_upper (test_simple.TestStrings) ... ok

Ran 1 test in 0.000s


However, nose2 supports more testing configuration and provides more tools than unittest on its own.

For example, this test exercises just a few of nose2’s features:

# in
from import params

@params("Sir Bedevere", "Miss Islington", "Duck")
def test_is_knight(value):
    assert value.startswith('Sir')

and then run this like so:

$ nose2 -v --pretty-assert
'Sir Bedevere' ... ok
'Miss Islington' ... FAIL
'Duck' ... FAIL

FAIL: test_fancy.test_is_knight:2
'Miss Islington'
Traceback (most recent call last):
  File "/mnt/ebs/home/sirosen/tmp/", line 6, in test_is_knight
    assert value.startswith('Sir')

>>> assert value.startswith('Sir')

    value = 'Miss Islington'
    value.startswith = <built-in method startswith of str object at 0x7f3c3172f430>
FAIL: test_fancy.test_is_knight:3
Traceback (most recent call last):
  File "/mnt/ebs/home/sirosen/tmp/", line 6, in test_is_knight
    assert value.startswith('Sir')

>>> assert value.startswith('Sir')

    value = 'Duck'
    value.startswith = <built-in method startswith of str object at 0x7f3c3172d490>
Ran 3 tests in 0.001s

FAILED (failures=2)

Full Docs

Full documentation for nose2 is available at

Versions and Support

Changelog and Version Scheme

nose2 versions are numbered 0.MAJOR.MINOR. Minor releases contain bugfixes or smaller features. Major features or backwards incompatible changes are done in major releases.

For a full description of all past versions and changes, see the changelog.

Python Versions

nose2 supports all currently supported python versions.

It also will continue to support python2 for as long as it remains feasible and a significant percentage of nose2 users are using python2.


If you want to make contributions, please read the contributing guide.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

nose2-0.11.0.tar.gz (167.3 kB view hashes)

Uploaded source

Built Distribution

nose2-0.11.0-py2.py3-none-any.whl (144.1 kB view hashes)

Uploaded py2 py3

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page