# nose2: The Successor to nose, Based on unittest2

This repository profile is provided by osrepos.com, an open source repository discovery platform.

Source: osrepos.com
Repository profile: https://osrepos.com/repo/nose-devs-nose2
Generated for open source discovery and AI-assisted research.

nose2 is a powerful testing framework for Python, designed as the successor to the popular nose project. Built upon Python's standard `unittest` module, it extends its capabilities to provide a more flexible and feature-rich testing experience. It aims to make writing and running tests in Python simpler and more efficient.

GitHub: https://github.com/nose-devs/nose2
OSRepos URL: https://osrepos.com/repo/nose-devs-nose2

## Summary

nose2 is a powerful testing framework for Python, designed as the successor to the popular nose project. Built upon Python's standard `unittest` module, it extends its capabilities to provide a more flexible and feature-rich testing experience. It aims to make writing and running tests in Python simpler and more efficient.

## Topics

- Python
- Testing
- Unit Testing
- nose2
- Testing Framework
- Python Library
- Software Development

## Repository Information

Last analyzed by OSRepos: Tue Aug 04 2026 20:05:28 GMT+0100 (Western European Summer Time)
Detail views: 0
GitHub clicks: 0

## Safety Notice

OSRepos shares public repositories for knowledge and discovery only. Review source code, dependencies, licenses, and security implications before running or installing anything.

## Content

## Introduction

**nose2** is a robust testing framework for Python, serving as the official successor to the widely-used `nose` project. Built directly on Python's standard `unittest` module, `nose2` extends its functionalities to offer a more flexible and feature-rich environment for writing and executing tests. Its primary goal is to simplify the testing process, making it more intuitive and powerful for Python developers. While `pytest` is a popular alternative for new projects, `nose2` provides a strong, `unittest`-based solution, especially for those familiar with or migrating from `nose`.

## Installation

Getting started with nose2 is straightforward. You can install it using pip:

bash
pip install nose2


## Examples

`nose2` automatically discovers tests in Python files whose names start with `test_` and runs every test function it finds.

Here's a basic example written in the standard `unittest` style:

python
# in test_simple.py
import unittest

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


You can run this test from your terminal:

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

----------------------------------------------------------------------
Ran 1 test in 0.000s

OK


`nose2` also provides additional tools and features beyond what `unittest` offers. For instance, you can use decorators like `@params` to run a test with multiple sets of arguments:

python
# in test_fancy.py
from nose2.tools import params

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


Running this with `nose2 -v --pretty-assert` demonstrates its enhanced output:

bash
$ nose2 -v --pretty-assert
test_fancy.test_is_knight:1
'Sir Bedevere' ... ok
test_fancy.test_is_knight:2
'Miss Islington' ... FAIL
test_fancy.test_is_knight:3
'Duck' ... FAIL

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

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

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

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

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

FAILED (failures=2)


## Why Use nose2?

`nose2` offers several compelling reasons for Python developers:

*   **`unittest` Foundation**: It builds upon the familiar `unittest` module, making it easy for developers already using `unittest` to transition and leverage `nose2`'s enhancements.
*   **Enhanced Test Discovery**: Automatically finds and runs tests, reducing boilerplate configuration.
*   **Extended Functionality**: Provides powerful tools and plugins, such as parameterized tests (`@params`) and improved assertion output (`--pretty-assert`), which go beyond standard `unittest` capabilities.
*   **Successor to `nose`**: For projects migrating from the original `nose` framework, `nose2` offers a modern and maintained alternative, though with some differences to be aware of.
*   **Active Development**: It supports current Python versions (Python 3) and aims to support PyPy and CPython betas.

## Links

*   **GitHub Repository**: [https://github.com/nose-devs/nose2](https://github.com/nose-devs/nose2){:target="_blank"}
*   **Official Documentation**: [https://docs.nose2.io/en/latest/](https://docs.nose2.io/en/latest/){:target="_blank"}
*   **PyPI Project Page**: [https://pypi.org/project/nose2/](https://pypi.org/project/nose2/){:target="_blank"}
*   **Mailing List**: [https://groups.google.com/a/nose2.io/forum/#!forum/discuss](https://groups.google.com/a/nose2.io/forum/#!forum/discuss){:target="_blank"}
*   **Contributing Guide**: [https://github.com/nose-devs/nose2/blob/main/contributing.rst](https://github.com/nose-devs/nose2/blob/main/contributing.rst){:target="_blank"}
*   **Differences from `nose`**: [https://docs.nose2.io/en/latest/differences.html](https://docs.nose2.io/en/latest/differences.html){:target="_blank"}
*   **Changelog**: [https://docs.nose2.io/en/latest/changelog.html](https://docs.nose2.io/en/latest/changelog.html){:target="_blank"}