{"id":4650,"library":"nose2","title":"nose2","description":"nose2 is the successor to Nose, developed to extend Python's standard `unittest` module with a rich plugin ecosystem to ease the testing process. It acts as a popular test runner that automatically discovers and executes unit tests within a project. The current version is 0.16.0. It follows a 0.MAJOR.MINOR versioning scheme, where major releases introduce new functionality or breaking changes, and minor releases focus on bug fixes or small features.","status":"active","version":"0.16.0","language":"en","source_language":"en","source_url":"https://github.com/nose-devs/nose2","tags":["testing","unittest","plugins","test runner","test discovery"],"install":[{"cmd":"pip install nose2","lang":"bash","label":"Install stable version"}],"dependencies":[{"reason":"Required for loading TOML configuration (e.g., from `pyproject.toml`'s `tool.nose2` table) on Python versions older than 3.11.","package":"tomli","optional":true},{"reason":"Required for the coverage plugin functionality, though the built-in coverage plugin is deprecated.","package":"coverage","optional":true}],"imports":[{"note":"Primarily used as a command-line tool, but can be imported for programmatic control or plugin development.","symbol":"nose2","correct":"import nose2"},{"symbol":"main","correct":"import nose2.main\nnose2.main()"}],"quickstart":{"code":"import unittest\n\nclass MyTests(unittest.TestCase):\n    def test_addition(self):\n        self.assertEqual(1 + 1, 2)\n\ndef test_subtraction():\n    assert 5 - 2 == 3\n\n# Save this as `test_math.py`\n# To run from the command line: `nose2`","lang":"python","description":"Create a Python file (e.g., `test_math.py`) with test functions prefixed with `test_` or `unittest.TestCase` subclasses with `test_` methods. Then, simply navigate to your project directory in the terminal and run `nose2` to discover and execute tests."},"warnings":[{"fix":"Review `nose2`'s plugin API and `differences` documentation for migration guidance from `nose`.","message":"nose2 is a distinct project from the original `nose` and is not fully backward compatible. `nose` plugins will not work with `nose2` without significant rewriting. Features like package-level fixtures supported by `nose` are not supported in `nose2`.","severity":"breaking","affected_versions":"All versions (since inception)"},{"fix":"Ensure your project runs on Python 3.9 or newer. Upgrade your Python environment if necessary.","message":"Python 2 is no longer supported; the last line supporting Python 2 was 0.12.x. As of version 0.16.0, support for Python 3.8 has also been removed. nose2 now requires Python >=3.9.","severity":"breaking","affected_versions":"0.13.0 and above (for Python 2), 0.16.0 and above (for Python 3.8)"},{"fix":"Consider using alternative coverage tools or integrating `coverage.py` directly into your test workflow outside of `nose2`'s plugin system.","message":"The built-in `coverage` plugin is deprecated as of version 0.16.0 and is no longer tested on newer Python versions. It will be removed in a future release.","severity":"deprecated","affected_versions":"0.16.0 and above"},{"fix":"Ensure that necessary plugins are enabled, either through configuration files (`unittest.cfg`, `nose2.cfg`, `pyproject.toml`) or command-line arguments.","message":"`nose2` relies heavily on its plugin system; if no plugins are loaded (e.g., using `--no-plugins`), `nose2` effectively does nothing.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Prefer running `nose2` directly from the command line (`nose2`) or use a dedicated test runner for your project if `setup.py test` causes issues.","message":"When using `test_suite='nose2.collector.collector'` with `python setup.py test`, `nose2` 'hijacks' the test running process, bypassing the standard `unittest` test result and runner. This might cause incompatibilities with certain packages or custom setups.","severity":"gotcha","affected_versions":"All versions"}],"env_vars":null,"last_verified":"2026-04-12T00:00:00.000Z","next_check":"2026-07-11T00:00:00.000Z"}