nose2


Namenose2 JSON
Version 0.15.1 PyPI version JSON
download
home_pageNone
Summaryunittest with plugins
upload_time2024-06-01 03:20:11
maintainerNone
docs_urlNone
authorNone
requires_python>=3.8
licenseBSD-2-Clause
keywords testing tests unittest
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage
            .. image:: https://results.pre-commit.ci/badge/github/nose-devs/nose2/main.svg
   :target: https://results.pre-commit.ci/latest/github/nose-devs/nose2/main
   :alt: pre-commit.ci status

.. image:: https://github.com/nose-devs/nose2/workflows/build/badge.svg?event=push
    :alt: build status
    :target: https://github.com/nose-devs/nose2/actions?query=workflow%3Abuild

.. image:: https://readthedocs.org/projects/nose2/badge/
    :target: https://nose2.io/
    :alt: Documentation

.. image:: https://img.shields.io/pypi/v/nose2.svg
    :target: https://pypi.org/project/nose2/
    :alt: Latest PyPI version

.. image:: https://img.shields.io/pypi/pyversions/nose2.svg
    :alt: Supported Python Versions
    :target: https://pypi.org/project/nose2/

.. image:: https://img.shields.io/badge/Mailing%20list-discuss%40nose2.io-blue.svg
    :target: https://groups.google.com/a/nose2.io/forum/#!forum/discuss
    :alt: Join discuss@nose2.io

Welcome to nose2
================

nose2's extends ``unittest`` to make testing nicer.

nose2 vs nose
-------------

``nose2`` originated as the successor to ``nose``.

``nose2`` is a distinct project and does not support all of the behaviors of ``nose``.
See `differences`_ for a thorough rundown.

nose2 vs pytest
---------------

`pytest`_ is an excellent test framework and we encourage users to consider
it for new projects.

It has a bigger team of maintainers and a larger community of users.

Quickstart
----------

Because ``nose2`` is based on unittest, you can start from the Python Standard
Library's `documentation for unittest <https://docs.python.org/library/unittest.html>`_
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:

.. code-block:: python

    # in test_simple.py
    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

    OK

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:

.. code-block:: 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')

and then run this like so::

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

Full Docs
---------

Full documentation for ``nose2`` is available at `docs.nose2.io`_

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 requires Python 3.

It supports all versions currently supported by the CPython team, and also aims
to support PyPy and cpython betas.

Python 2
********

Python 2 is no longer supported. The `0.12.x line of releases <py2line>`_
contains the last versions which supported Python 2.

Users of Python 2 should understand that Python 2 is EOL and the Python 2
support line for ``nose2`` is similarly considered EOL.

.. note::

    Fixes to 0.12.x may still be accepted on an as-needed basis for a short
    while as the python3-only line of releases gets started.

Contributing
------------

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

.. _py2line: https://github.com/nose-devs/nose2/tree/0.12.x-line

.. _differences: https://docs.nose2.io/en/latest/differences.html

.. _changelog: https://docs.nose2.io/en/latest/changelog.html

.. _pytest: http://pytest.readthedocs.io/en/latest/

.. _contributing: https://github.com/nose-devs/nose2/blob/main/contributing.rst

.. _docs.nose2.io: https://docs.nose2.io/en/latest/

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "nose2",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": null,
    "keywords": "testing, tests, unittest",
    "author": null,
    "author_email": "Stephen Rosen <dev@nose2.io>",
    "download_url": "https://files.pythonhosted.org/packages/9b/a6/f29c21026c40476ce3994ac55e16ef60b9c1d2a88d02c3fc20b07d253dab/nose2-0.15.1.tar.gz",
    "platform": null,
    "description": ".. image:: https://results.pre-commit.ci/badge/github/nose-devs/nose2/main.svg\n   :target: https://results.pre-commit.ci/latest/github/nose-devs/nose2/main\n   :alt: pre-commit.ci status\n\n.. image:: https://github.com/nose-devs/nose2/workflows/build/badge.svg?event=push\n    :alt: build status\n    :target: https://github.com/nose-devs/nose2/actions?query=workflow%3Abuild\n\n.. image:: https://readthedocs.org/projects/nose2/badge/\n    :target: https://nose2.io/\n    :alt: Documentation\n\n.. image:: https://img.shields.io/pypi/v/nose2.svg\n    :target: https://pypi.org/project/nose2/\n    :alt: Latest PyPI version\n\n.. image:: https://img.shields.io/pypi/pyversions/nose2.svg\n    :alt: Supported Python Versions\n    :target: https://pypi.org/project/nose2/\n\n.. image:: https://img.shields.io/badge/Mailing%20list-discuss%40nose2.io-blue.svg\n    :target: https://groups.google.com/a/nose2.io/forum/#!forum/discuss\n    :alt: Join discuss@nose2.io\n\nWelcome to nose2\n================\n\nnose2's extends ``unittest`` to make testing nicer.\n\nnose2 vs nose\n-------------\n\n``nose2`` originated as the successor to ``nose``.\n\n``nose2`` is a distinct project and does not support all of the behaviors of ``nose``.\nSee `differences`_ for a thorough rundown.\n\nnose2 vs pytest\n---------------\n\n`pytest`_ is an excellent test framework and we encourage users to consider\nit for new projects.\n\nIt has a bigger team of maintainers and a larger community of users.\n\nQuickstart\n----------\n\nBecause ``nose2`` is based on unittest, you can start from the Python Standard\nLibrary's `documentation for unittest <https://docs.python.org/library/unittest.html>`_\nand then use nose2 to add value on top of that.\n\n``nose2`` looks for tests in Python files whose names start with ``test`` and\nruns every test function it discovers.\n\nHere's an example of a simple test, written in typical unittest style:\n\n.. code-block:: python\n\n    # in test_simple.py\n    import unittest\n\n    class TestStrings(unittest.TestCase):\n        def test_upper(self):\n            self.assertEqual(\"spam\".upper(), \"SPAM\")\n\nYou can then run this test like so::\n\n    $ nose2 -v\n    test_upper (test_simple.TestStrings) ... ok\n\n    ----------------------------------------------------------------------\n    Ran 1 test in 0.000s\n\n    OK\n\nHowever, ``nose2`` supports more testing configuration and provides more tools\nthan ``unittest`` on its own.\n\nFor example, this test exercises just a few of ``nose2``'s features:\n\n.. code-block:: python\n\n    # in test_fancy.py\n    from nose2.tools import params\n\n    @params(\"Sir Bedevere\", \"Miss Islington\", \"Duck\")\n    def test_is_knight(value):\n        assert value.startswith('Sir')\n\nand then run this like so::\n\n    $ nose2 -v --pretty-assert\n    test_fancy.test_is_knight:1\n    'Sir Bedevere' ... ok\n    test_fancy.test_is_knight:2\n    'Miss Islington' ... FAIL\n    test_fancy.test_is_knight:3\n    'Duck' ... FAIL\n\n    ======================================================================\n    FAIL: test_fancy.test_is_knight:2\n    'Miss Islington'\n    ----------------------------------------------------------------------\n    Traceback (most recent call last):\n      File \"/mnt/ebs/home/sirosen/tmp/test_fancy.py\", line 6, in test_is_knight\n        assert value.startswith('Sir')\n    AssertionError\n\n    >>> assert value.startswith('Sir')\n\n    values:\n        value = 'Miss Islington'\n        value.startswith = <built-in method startswith of str object at 0x7f3c3172f430>\n    ======================================================================\n    FAIL: test_fancy.test_is_knight:3\n    'Duck'\n    ----------------------------------------------------------------------\n    Traceback (most recent call last):\n      File \"/mnt/ebs/home/sirosen/tmp/test_fancy.py\", line 6, in test_is_knight\n        assert value.startswith('Sir')\n    AssertionError\n\n    >>> assert value.startswith('Sir')\n\n    values:\n        value = 'Duck'\n        value.startswith = <built-in method startswith of str object at 0x7f3c3172d490>\n    ----------------------------------------------------------------------\n    Ran 3 tests in 0.001s\n\n    FAILED (failures=2)\n\nFull Docs\n---------\n\nFull documentation for ``nose2`` is available at `docs.nose2.io`_\n\nVersions and Support\n--------------------\n\nChangelog and Version Scheme\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\nnose2 versions are numbered ``0.MAJOR.MINOR``. Minor releases contain bugfixes or\nsmaller features. Major features or backwards incompatible changes are done in\nmajor releases.\n\nFor a full description of all past versions and changes, see the `changelog`_.\n\nPython Versions\n~~~~~~~~~~~~~~~\n\nnose2 requires Python 3.\n\nIt supports all versions currently supported by the CPython team, and also aims\nto support PyPy and cpython betas.\n\nPython 2\n********\n\nPython 2 is no longer supported. The `0.12.x line of releases <py2line>`_\ncontains the last versions which supported Python 2.\n\nUsers of Python 2 should understand that Python 2 is EOL and the Python 2\nsupport line for ``nose2`` is similarly considered EOL.\n\n.. note::\n\n    Fixes to 0.12.x may still be accepted on an as-needed basis for a short\n    while as the python3-only line of releases gets started.\n\nContributing\n------------\n\nIf you want to make contributions, please read the `contributing`_ guide.\n\n.. _py2line: https://github.com/nose-devs/nose2/tree/0.12.x-line\n\n.. _differences: https://docs.nose2.io/en/latest/differences.html\n\n.. _changelog: https://docs.nose2.io/en/latest/changelog.html\n\n.. _pytest: http://pytest.readthedocs.io/en/latest/\n\n.. _contributing: https://github.com/nose-devs/nose2/blob/main/contributing.rst\n\n.. _docs.nose2.io: https://docs.nose2.io/en/latest/\n",
    "bugtrack_url": null,
    "license": "BSD-2-Clause",
    "summary": "unittest with plugins",
    "version": "0.15.1",
    "project_urls": {
        "changelog": "https://docs.nose2.io/en/latest/changelog.html",
        "documentation": "https://docs.nose2.io/",
        "repository": "https://github.com/nose-devs/nose2"
    },
    "split_keywords": [
        "testing",
        " tests",
        " unittest"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "87e66babe53a1dbfa55f6d30eb7408f4c4994658e5f27e3dbbb2b437912e5a32",
                "md5": "d3f1a016d92fead6cc7c91e6e6eab91c",
                "sha256": "564450c0c4f1602dfe171902ceb4726cc56658af7a620ae1826f1ffc86b09a86"
            },
            "downloads": -1,
            "filename": "nose2-0.15.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "d3f1a016d92fead6cc7c91e6e6eab91c",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 211274,
            "upload_time": "2024-06-01T03:20:04",
            "upload_time_iso_8601": "2024-06-01T03:20:04.423295Z",
            "url": "https://files.pythonhosted.org/packages/87/e6/6babe53a1dbfa55f6d30eb7408f4c4994658e5f27e3dbbb2b437912e5a32/nose2-0.15.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "9ba6f29c21026c40476ce3994ac55e16ef60b9c1d2a88d02c3fc20b07d253dab",
                "md5": "2e5690056a6931efc668225c52c1f590",
                "sha256": "36770f519df5becd3cbfe0bee4abbfbf9b9f6b4eb4e03361d282b7efcfc4f0df"
            },
            "downloads": -1,
            "filename": "nose2-0.15.1.tar.gz",
            "has_sig": false,
            "md5_digest": "2e5690056a6931efc668225c52c1f590",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 169809,
            "upload_time": "2024-06-01T03:20:11",
            "upload_time_iso_8601": "2024-06-01T03:20:11.435781Z",
            "url": "https://files.pythonhosted.org/packages/9b/a6/f29c21026c40476ce3994ac55e16ef60b9c1d2a88d02c3fc20b07d253dab/nose2-0.15.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-06-01 03:20:11",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "nose-devs",
    "github_project": "nose2",
    "travis_ci": false,
    "coveralls": true,
    "github_actions": true,
    "tox": true,
    "lcname": "nose2"
}
        
Elapsed time: 0.24745s