nose2: The Successor to nose, Based on unittest2

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

nose2: The Successor to nose, Based on unittest2

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.

Repository Information

Analyzed by OSRepos on August 4, 2026

Topics

Click on any tag to explore related repositories

Use at your own risk

OSRepos shares public repositories for knowledge and discovery only. Any installation, execution, configuration, or use of code from these repositories is the user's own responsibility. Always review the repository, source code, dependencies, licenses, and security implications before running or installing anything. OSRepos is not responsible for issues, damages, or losses resulting from third-party repositories.

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:

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:

# 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:

$ 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:

# 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:

$ 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

Related repositories

Similar repositories that may be relevant next.

PyAutoGUI: Cross-Platform GUI Automation with Python

PyAutoGUI: Cross-Platform GUI Automation with Python

August 4, 2026

PyAutoGUI is an intuitive Python module designed for cross-platform GUI automation, enabling users to programmatically control the mouse and keyboard. It simplifies complex desktop interactions, allowing for tasks like clicking, typing, and taking screenshots across Windows, macOS, and Linux. This powerful library is ideal for automating repetitive tasks and creating bots.

PythonGUI AutomationDesktop Automation
Freezegun: Time Travel for Your Python Tests

Freezegun: Time Travel for Your Python Tests

August 4, 2026

Freezegun is a powerful Python library designed to simplify testing by allowing your tests to travel through time. It achieves this by mocking the `datetime` module, enabling developers to freeze time at a specific point or even simulate its progression. This functionality is crucial for ensuring consistent and reliable test results when dealing with time-sensitive logic.

PythonTestingMocking
HTTPretty: Intercepting HTTP Requests for Python Testing

HTTPretty: Intercepting HTTP Requests for Python Testing

August 3, 2026

HTTPretty is a powerful Python library designed to intercept HTTP requests at the socket level, effectively faking the entire socket module. It provides a robust solution for mocking external HTTP services, making it ideal for test-driven development and reliable API integration testing. Developers can use HTTPretty to simulate various HTTP responses, ensuring comprehensive and isolated testing environments.

PythonHTTP MockingTesting
Mixer: A Powerful Fixture Replacement for Python ORMs and ODMs

Mixer: A Powerful Fixture Replacement for Python ORMs and ODMs

August 3, 2026

Mixer is a versatile Python library designed to replace fixtures and generate test data efficiently. It supports various ORMs and ODMs, including Django, SQLAlchemy, Flask-SQLAlchemy, Mongoengine, and Marshmallow, making it an invaluable tool for testing and development workflows.

PythonDjangoFlask

Source repository

Open the original repository on GitHub.

View on GitHub
OS
OSRepos

Analysis and discovery of open source repositories. Find interesting projects and follow their updates.

Monitor your website with YourWebsiteScore

OSRepos shares public repositories for knowledge and discovery only. Any installation, execution, configuration, or use of third-party repository code is at your own risk. Always review source code, dependencies, licenses, and security implications before running anything.

© 2025 OSRepos. Built with Nuxt 3 and lots of ❤️