METADATA 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  1. Metadata-Version: 2.1
  2. Name: pytest-remotedata
  3. Version: 0.3.2
  4. Summary: Pytest plugin for controlling remote data access.
  5. Home-page: https://astropy.org
  6. Author: The Astropy Developers
  7. Author-email: astropy.team@gmail.com
  8. License: BSD
  9. Keywords: remote,data,pytest,py.test
  10. Platform: UNKNOWN
  11. Classifier: Development Status :: 3 - Alpha
  12. Classifier: Framework :: Pytest
  13. Classifier: Intended Audience :: Developers
  14. Classifier: License :: OSI Approved :: BSD License
  15. Classifier: Operating System :: OS Independent
  16. Classifier: Programming Language :: Python
  17. Classifier: Programming Language :: Python :: 2.7
  18. Classifier: Programming Language :: Python :: 3
  19. Classifier: Programming Language :: Python :: 3.3
  20. Classifier: Programming Language :: Python :: 3.4
  21. Classifier: Programming Language :: Python :: 3.5
  22. Classifier: Programming Language :: Python :: 3.6
  23. Classifier: Programming Language :: Python :: Implementation :: CPython
  24. Classifier: Topic :: Software Development :: Testing
  25. Classifier: Topic :: Utilities
  26. Requires-Python: >=2.7
  27. Requires-Dist: six
  28. Requires-Dist: pytest (>=3.1)
  29. =================
  30. pytest-remotedata
  31. =================
  32. This package provides a plugin for the `pytest`_ framework that allows
  33. developers to control unit tests that require access to data from the internet.
  34. It was originally part of the `astropy`_ core package, but has been moved to a
  35. separate package in order to be of more general use.
  36. .. _pytest: https://pytest.org/en/latest/
  37. .. _astropy: https://astropy.org/en/latest/
  38. Motivation
  39. ----------
  40. Many software packages provide features that require access to data from the
  41. internet. These features need to be tested, but unit tests that access the
  42. internet can dominate the overall runtime of a test suite.
  43. The ``pytest-remotedata`` plugin allows developers to indicate which unit tests
  44. require access to the internet, and to control when and whether such tests
  45. should execute as part of any given run of the test suite.
  46. Installation
  47. ------------
  48. The ``pytest-remotedata`` plugin can be installed using ``pip``::
  49. $ pip install pytest-remotedata
  50. It is also possible to install the latest development version from the source
  51. repository::
  52. $ git clone https://github.com/astropy/pytest-remotedata
  53. $ cd pytest-remotedata
  54. $ python ./setup.py install
  55. In either case, the plugin will automatically be registered for use with
  56. ``pytest``.
  57. Usage
  58. -----
  59. Installing this plugin makes two decorators available for use with ``pytest``:
  60. * ``remote_data`` for marking tests that require data from the internet
  61. * ``internet_off`` for marking tests that should run only when internet access
  62. is disabled
  63. These decorators can be used to mark test functions, methods, and classes using
  64. ``@pytest.mark``. For example, consider the following test function that
  65. requires access to data from the internet:
  66. .. code-block:: python
  67. import pytest
  68. from urllib.request import urlopen
  69. @pytest.mark.remote_data
  70. def test_remote_data():
  71. urlopen('https://astropy.org')
  72. Marking the ``test_remote_data`` function with ``@pytest.mark.remote_data``
  73. indicates to ``pytest`` that this test should be run only when access to remote
  74. data sources is explicitly requested.
  75. When this plugin is installed, the ``--remote-data`` command line option is
  76. added to the ``pytest`` command line interface.
  77. The default behavior is to skip tests that are marked with ``remote_data``.
  78. If the ``--remote-data`` option is not provided to the ``pytest`` command, or
  79. if ``--remote-data=none`` is provided, all tests that are marked with
  80. ``remote_data`` will be skipped. All tests that are marked with
  81. ``internet_off`` will be executed.
  82. Sometimes it is useful to check that certain tests do not unexpectedly access
  83. the internet. Strict remote data access checking can be enabled by setting
  84. ``remote_data_strict = true`` in the tested package's ``setup.cfg`` file. If
  85. this option is enabled, any test that attempts to access the network but is not
  86. marked with ``@pytest.mark.remote_data`` will fail.
  87. Providing either the ``--remote-data`` option, or ``--remote-data=any`` to the
  88. ``pytest`` command line interface will cause all tests that are marked with
  89. ``remote-data`` to execute. Any tests that are marked with ``internet_off``
  90. will be skipped.
  91. Running the tests with ``--remote-data=astropy`` will cause only tests that
  92. receive remote data from Astropy data sources to be run. Tests with any other
  93. data sources will be skipped. This is indicated in the test code by marking
  94. test functions with ``@pytest.mark.remote_data(source='astropy')``.
  95. In the future, we intend to support a configurable way to indicate specific
  96. remote data sources in addition to ``astropy``.
  97. Development Status
  98. ------------------
  99. .. image:: https://travis-ci.org/astropy/pytest-remotedata.svg
  100. :target: https://travis-ci.org/astropy/pytest-remotedata
  101. :alt: Travis CI Status
  102. .. image:: https://ci.appveyor.com/api/projects/status/ym7lxajcs5qwm31e/branch/master?svg=true
  103. :target: https://ci.appveyor.com/project/Astropy/pytest-remotedata/branch/master
  104. :alt: Appveyor Status
  105. Questions, bug reports, and feature requests can be submitted on `github`_.
  106. .. _github: https://github.com/astropy/pytest-remotedata
  107. License
  108. -------
  109. This plugin is licensed under a 3-clause BSD style license - see the
  110. ``LICENSE.rst`` file.