Nose Testing Framework

1.3.7 · abandoned · verified Thu Apr 09

Nose extends unittest to make testing easier, providing a simpler test discovery and running mechanism. Its last major release was 1.3.7 in 2015, and the project is no longer actively maintained. Users are strongly encouraged to migrate to modern alternatives like pytest.

Warnings

Install

Imports

Quickstart

This example demonstrates a basic Nose test case using unittest.TestCase. Nose discovers tests by default from files named `test_*.py` or classes/functions starting with `test_`. The common way to run tests is via the `nosetests` command line tool.

import nose
from unittest import TestCase

class MyTest(TestCase):
    def test_something(self):
        self.assertEqual(1, 1)

if __name__ == '__main__':
    # To run this directly without the `nosetests` command:
    # nose.run()
    # For programmatic execution, typically you'd run from command line.
    print("Run with: nosetests")
    # Example of what `nosetests` would do if run programmatically:
    # nose.run(argv=['', '--verbose', __file__])

view raw JSON →