{ "info": { "author": "The Astropy Developers", "author_email": "astropy.team@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 3 - Alpha", "Framework :: Pytest", "Intended Audience :: Developers", "License :: OSI Approved :: BSD License", "Operating System :: OS Independent", "Programming Language :: Python", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.3", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: Implementation :: CPython", "Topic :: Software Development :: Testing", "Topic :: Utilities" ], "description": "==================\npytest-doctestplus\n==================\n\nThis package contains a plugin for the `pytest`_ framework that provides\nadvanced doctest support and enables the testing of `reStructuredText`_\n(\".rst\") files. It was originally part of the `astropy`_ core package, but has\nbeen moved to a separate package in order to be of more general use.\n\n.. _pytest: https://pytest.org/en/latest/\n.. _astropy: https://astropy.org/en/latest/\n.. _reStructuredText: https://en.wikipedia.org/wiki/ReStructuredText\n\n\nMotivation\n----------\n\nThis plugin provides advanced features for testing example Python code that is\nincluded in Python docstrings and in standalone documentation files.\n\nGood documentation for developers contains example code. This is true of both\nstandalone documentation and of documentation that is integrated with the code\nitself. Python provides a mechanism for testing code snippets that are provided\nin Python docstrings. The unit test framework pytest provides a mechanism for\nrunning doctests against both docstrings in source code and in standalone\ndocumentation files.\n\nThis plugin augments the functionality provided by Python and pytest by\nproviding the following features:\n\n* approximate floating point comparison for doctests that produce floating\n point results (see `Floating Point Comparison`_)\n* skipping particular classes, methods, and functions when running doctests (see `Skipping Tests`_)\n* handling doctests that use remote data in conjunction with the\n `pytest-remotedata`_ plugin (see `Remote Data`_)\n* optional inclusion of ``*.rst`` files for doctests (see `Setup and Configuration`_)\n\n.. _pytest-remotedata: https://github.com/astropy/pytest-remotedata\n\nInstallation\n------------\n\nThe ``pytest-doctestplus`` plugin can be installed using ``pip``::\n\n $ pip install pytest-doctestplus\n\nIt is also possible to install the latest development version from the source\nrepository::\n\n $ git clone https://github.com/astropy/pytest-doctestplus\n $ cd pytest-doctestplus\n $ python ./setup.py install\n\nIn either case, the plugin will automatically be registered for use with\n``pytest``.\n\nUsage\n-----\n\n.. _setup:\n\nSetup and Configuration\n~~~~~~~~~~~~~~~~~~~~~~~\n\nThis plugin provides two command line options: ``--doctest-plus`` for enabling\nthe advanced features mentioned above, and ``--doctest-rst`` for including\n``*.rst`` files in doctest collection.\n\nThis plugin can also be enabled by default by adding ``doctest_plus = enabled``\nto the ``[tool:pytest]`` section of the package's ``setup.cfg`` file.\n\nThe plugin is applied to all directories and files that ``pytest`` collects.\nThis means that configuring ``testpaths`` and ``norecursedirs`` in\n``setup.cfg`` also affects the files that will be discovered by\n``pytest-doctestplus``. In addition, this plugin provides a\n``doctest_norecursedirs`` configuration variable that indicates directories\nthat should be ignored by ``pytest-doctestplus`` but do not need to be ignored\nby other ``pytest`` features.\n\nUsing ``pytest``'s built-in ``--doctest-modules`` option will override the\nbehavior of this plugin, even if ``doctest_plus = enabled`` in ``setup.cfg``,\nand will cause the default doctest plugin to be used. However, if for some\nreason both ``--doctest-modules`` and ``--doctest-plus`` are given, the\n``pytest-doctestplus`` plugin will be used, regardless of the contents of\n``setup.cfg``.\n\nThis plugin respects the doctest options that are used by the built-in doctest\nplugin and are set in ``doctest_optionflags`` in ``setup.cfg``. By default,\n``ELLIPSIS`` and ``NORMALIZE_WHITESPACE`` are used. For a description of all\ndoctest settings, see the `doctest documentation\n`_.\n\nDoctest Directives\n~~~~~~~~~~~~~~~~~~\n\nThe ``pytest-doctestplus`` plugin defines `doctest directives`_ that are used\nto control the behavior of particular features. For general information on\ndirectives and how they are used, consult the `documentation`_. The specifics\nof the directives that this plugin defines are described in the sections below.\n\n.. _doctest directives: https://docs.python.org/3/library/doctest.html#directives\n.. _documentation: https://docs.python.org/3/library/doctest.html#directives\n\nFloating Point Comparison\n~~~~~~~~~~~~~~~~~~~~~~~~~\n\nSome doctests may produce output that contains string representations of\nfloating point values. Floating point representations are often not exact and\ncontain roundoffs in their least significant digits. Depending on the platform\nthe tests are being run on (different Python versions, different OS, etc.) the\nexact number of digits shown can differ. Because doctests work by comparing\nstrings this can cause such tests to fail.\n\nTo address this issue, the ``pytest-doctestplus`` plugin provides support for a\n``FLOAT_CMP`` flag that can be used with doctests. For example:\n\n.. code-block:: python\n\n >>> 1.0 / 3.0 # doctest: +FLOAT_CMP\n 0.333333333333333311\n\nWhen this flag is used, the expected and actual outputs are both parsed to find\nany floating point values in the strings. Those are then converted to actual\nPython `float` objects and compared numerically. This means that small\ndifferences in representation of roundoff digits will be ignored by the\ndoctest. The values are otherwise compared exactly, so more significant\n(albeit possibly small) differences will still be caught by these tests.\n\nThis flag can be enabled globally by adding it to ``setup.cfg`` as in\n\n.. code-block:: ini\n\n doctest_optionflags =\n NORMALIZE_WHITESPACE\n ELLIPSIS\n FLOAT_CMP\n\n\nSkipping Tests\n~~~~~~~~~~~~~~\n\nDoctest provides the ``+SKIP`` directive for skipping statements that should\nnot be executed when testing documentation. However, it is often useful to be\nable to skip docstrings associated with particular functions, methods, classes,\nor even entire files.\n\nSkip Unconditionally\n^^^^^^^^^^^^^^^^^^^^\n\nThe ``pytest-doctestplus`` plugin provides a way to indicate that certain\ndocstrings should be skipped altogether. This is configured by defining the\nvariable ``__doctest_skip__`` in each module where tests should be skipped. The\nvalue of ``__doctest_skip__`` should be a list of wildcard patterns for all\nfunctions/classes whose doctests should be skipped. For example::\n\n __doctest_skip__ = ['myfunction', 'MyClass', 'MyClass.*']\n\nskips the doctests in a function called ``myfunction``, the doctest for a\nclass called ``MyClass``, and all *methods* of ``MyClass``.\n\nModule docstrings may contain doctests as well. To skip the module-level\ndoctests::\n\n __doctest_skip__ = ['.', 'myfunction', 'MyClass']\n\nTo skip all doctests in a module::\n\n __doctest_skip__ = ['*']\n\nDoctest Dependencies\n^^^^^^^^^^^^^^^^^^^^\n\nIt is also possible to skip certain doctests depending on whether particular\ndependencies are available. This is configured by defining the variable\n``__doctest_requires__`` at the module level. The value of this variable is\na dictionary that indicates the modules that are required to run the doctests\nassociated with particular functions, classes, and methods.\n\nThe keys in the dictionary are wildcard patterns like those described above, or\ntuples of wildcard patterns, indicating which docstrings should be skipped. The\nvalues in the dictionary are lists of module names that are required in order\nfor the given doctests to be executed.\n\nConsider the following example::\n\n __doctest_requires__ = {('func1', 'func2'): ['scipy']}\n\nHaving this module-level variable will require ``scipy`` to be importable\nin order to run the doctests for functions ``func1`` and ``func2`` in that\nmodule.\n\nRemote Data\n~~~~~~~~~~~\n\nThe ``pytest-doctestplus`` plugin can be used in conjunction with the\n`pytest-remotedata`_ plugin in order to control doctest code that requires\naccess to data from the internet. In order to make use of these features, the\n``pytest-remotedata`` plugin must be installed, and remote data access must\nbe enabled using the ``--remote-data`` command line option to ``pytest``. See\nthe `pytest-remotedata plugin documentation`__ for more details.\n\nThe following example illustrates how a doctest that uses remote data should be\nmarked::\n\n .. code-block:: python\n\n >>> from urlib.request import urlopen\n >>> url = urlopen('http://astropy.org') # doctest: +REMOTE_DATA\n\nThe ``+REMOTE_DATA`` directive indicates that the marked statement should only\nbe executed if the ``--remote-data`` option is given. By default, all\nstatements marked with ``--remote-data`` will be skipped.\n\n.. _pytest-remotedata: https://github.com/astropy/pytest-remotedata\n__ pytest-remotedata_\n\nDevelopment Status\n------------------\n\n.. image:: https://travis-ci.org/astropy/pytest-doctestplus.svg\n :target: https://travis-ci.org/astropy/pytest-doctestplus\n :alt: Travis CI Status\n\nQuestions, bug reports, and feature requests can be submitted on `github`_.\n\n.. _github: https://github.com/astropy/pytest-doctestplus\n\nLicense\n-------\nThis plugin is licensed under a 3-clause BSD style license - see the\n``LICENSE.rst`` file.", "description_content_type": "", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://astropy.org", "keywords": "doctest,rst,pytest,py.test", "license": "BSD", "maintainer": "", "maintainer_email": "", "name": "pytest-doctestplus", "package_url": "https://pypi.org/project/pytest-doctestplus/", "platform": "", "project_url": "https://pypi.org/project/pytest-doctestplus/", "project_urls": { "Homepage": "https://astropy.org" }, "release_url": "https://pypi.org/project/pytest-doctestplus/0.4.0/", "requires_dist": null, "requires_python": ">=2.7", "summary": "Pytest plugin with advanced doctest features.", "version": "0.4.0" }, "last_serial": 5851622, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "8fec9827f5f0ebddc43a2b44a9a19b4d", "sha256": "80a03db6f57eacd2800db89aa01b37cf2b08c8b06482284e04c61cdc69172abb" }, "downloads": -1, "filename": "pytest-doctestplus-0.1.0.tar.gz", "has_sig": true, "md5_digest": "8fec9827f5f0ebddc43a2b44a9a19b4d", "packagetype": "sdist", "python_version": "source", "requires_python": ">=2.7", "size": 10672, "upload_time": "2017-10-10T18:12:42", "url": "https://files.pythonhosted.org/packages/d9/ae/ccda809c61216f7b585139f2aa1d2222d24b3bb5fcca5df518522cd863ed/pytest-doctestplus-0.1.0.tar.gz" } ], "0.1.1": [ { "comment_text": "", "digests": { "md5": "84d47cb2e48efc5e11a786ba95a493d6", "sha256": "b7a204af69885c8677cbf414b7539ad280f496633d03dfaf690653c8960a7812" }, "downloads": -1, "filename": "pytest-doctestplus-0.1.1.tar.gz", "has_sig": true, "md5_digest": "84d47cb2e48efc5e11a786ba95a493d6", "packagetype": "sdist", "python_version": "source", "requires_python": ">=2.7", "size": 10881, "upload_time": "2017-10-18T20:04:52", "url": "https://files.pythonhosted.org/packages/b8/83/7d8d8210224da74232429b41d3b767cd8de2b5d6bbd415ab39346b66c80b/pytest-doctestplus-0.1.1.tar.gz" } ], "0.1.2": [ { "comment_text": "", "digests": { "md5": "4929b135dfff1b1bded726a2c719c101", "sha256": "07672d4a6950d5f5ad48648edd30663be9770435af5baa6c692810c39e0f6648" }, "downloads": -1, "filename": "pytest-doctestplus-0.1.2.tar.gz", "has_sig": true, "md5_digest": "4929b135dfff1b1bded726a2c719c101", "packagetype": "sdist", "python_version": "source", "requires_python": ">=2.7", "size": 14217, "upload_time": "2017-12-07T21:31:00", "url": "https://files.pythonhosted.org/packages/83/ad/fdafa7993090c3e55a28027a6bdf1da8b3ee393c5fdc61dc6732cff50d80/pytest-doctestplus-0.1.2.tar.gz" } ], "0.1.3": [ { "comment_text": "", "digests": { "md5": "c8c3107a601aadd3dad05b9dd6c68d1d", "sha256": "91a5f81ff9e2038d363f6d49f4ec3c1b9726cc989ae8e3f227689a3793aa51fc" }, "downloads": -1, "filename": "pytest-doctestplus-0.1.3.tar.gz", "has_sig": true, "md5_digest": "c8c3107a601aadd3dad05b9dd6c68d1d", "packagetype": "sdist", "python_version": "source", "requires_python": ">=2.7", "size": 13169, "upload_time": "2018-04-20T18:01:11", "url": "https://files.pythonhosted.org/packages/f4/41/f78d44d612fb8c182105b64bb9ddd537f533cd553e0611b343ebac40bad3/pytest-doctestplus-0.1.3.tar.gz" } ], "0.2.0": [ { "comment_text": "", "digests": { "md5": "1ab4e8b08e2de65250c95f11574cab71", "sha256": "f18fe570201e5e8182cbc50a5db7b9b3185faaee9da1635dc1e36296660e9b5a" }, "downloads": -1, "filename": "pytest-doctestplus-0.2.0.tar.gz", "has_sig": true, "md5_digest": "1ab4e8b08e2de65250c95f11574cab71", "packagetype": "sdist", "python_version": "source", "requires_python": ">=2.7", "size": 17606, "upload_time": "2018-11-14T19:39:46", "url": "https://files.pythonhosted.org/packages/28/ba/51690aebf7b86bd18181414cb2f19795a3eeaf1d1eddf777f7f35bd397bb/pytest-doctestplus-0.2.0.tar.gz" } ], "0.3.0": [ { "comment_text": "", "digests": { "md5": "c4ed640675a548ee383835a28f09f079", "sha256": "4e641bc720661c08ec3afe44a7951660cdff5e187259c433aa66e9ec2d5ccea1" }, "downloads": -1, "filename": "pytest-doctestplus-0.3.0.tar.gz", "has_sig": true, "md5_digest": "c4ed640675a548ee383835a28f09f079", "packagetype": "sdist", "python_version": "source", "requires_python": ">=2.7", "size": 19620, "upload_time": "2019-03-06T18:35:45", "url": "https://files.pythonhosted.org/packages/40/09/4c9db3d0b83d52aced3f8925c7690ee5f7f59d7af16eef95e45940e5b0f4/pytest-doctestplus-0.3.0.tar.gz" } ], "0.4.0": [ { "comment_text": "", "digests": { "md5": "70f224f8e5440c5efc6d25b06cb29982", "sha256": "8872b9c236924af20c39c2813d7f1bde50a1edca7c4aba5a8bfbae3a32360e87" }, "downloads": -1, "filename": "pytest-doctestplus-0.4.0.tar.gz", "has_sig": true, "md5_digest": "70f224f8e5440c5efc6d25b06cb29982", "packagetype": "sdist", "python_version": "source", "requires_python": ">=2.7", "size": 19783, "upload_time": "2019-09-18T17:38:41", "url": "https://files.pythonhosted.org/packages/7a/4d/cab8cf0396bf7da36b5053f17a35203e9726096d21b971e9d57ebd0b7b9d/pytest-doctestplus-0.4.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "70f224f8e5440c5efc6d25b06cb29982", "sha256": "8872b9c236924af20c39c2813d7f1bde50a1edca7c4aba5a8bfbae3a32360e87" }, "downloads": -1, "filename": "pytest-doctestplus-0.4.0.tar.gz", "has_sig": true, "md5_digest": "70f224f8e5440c5efc6d25b06cb29982", "packagetype": "sdist", "python_version": "source", "requires_python": ">=2.7", "size": 19783, "upload_time": "2019-09-18T17:38:41", "url": "https://files.pythonhosted.org/packages/7a/4d/cab8cf0396bf7da36b5053f17a35203e9726096d21b971e9d57ebd0b7b9d/pytest-doctestplus-0.4.0.tar.gz" } ] }