METADATA 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. Metadata-Version: 2.1
  2. Name: pytest-mock
  3. Version: 3.14.0
  4. Summary: Thin-wrapper around the mock package for easier use with pytest
  5. Author-email: Bruno Oliveira <nicoddemus@gmail.com>
  6. License: MIT
  7. Project-URL: Homepage, https://github.com/pytest-dev/pytest-mock/
  8. Project-URL: Documentation, https://pytest-mock.readthedocs.io/en/latest/
  9. Project-URL: Changelog, https://pytest-mock.readthedocs.io/en/latest/changelog.html
  10. Project-URL: Source, https://github.com/pytest-dev/pytest-mock/
  11. Project-URL: Tracker, https://github.com/pytest-dev/pytest-mock/issues
  12. Keywords: pytest,mock
  13. Classifier: Development Status :: 5 - Production/Stable
  14. Classifier: Framework :: Pytest
  15. Classifier: Intended Audience :: Developers
  16. Classifier: License :: OSI Approved :: MIT License
  17. Classifier: Operating System :: OS Independent
  18. Classifier: Programming Language :: Python :: 3
  19. Classifier: Programming Language :: Python :: 3 :: Only
  20. Classifier: Programming Language :: Python :: 3.8
  21. Classifier: Programming Language :: Python :: 3.9
  22. Classifier: Programming Language :: Python :: 3.10
  23. Classifier: Programming Language :: Python :: 3.11
  24. Classifier: Programming Language :: Python :: 3.12
  25. Classifier: Topic :: Software Development :: Testing
  26. Requires-Python: >=3.8
  27. Description-Content-Type: text/x-rst
  28. License-File: LICENSE
  29. Requires-Dist: pytest >=6.2.5
  30. Provides-Extra: dev
  31. Requires-Dist: pre-commit ; extra == 'dev'
  32. Requires-Dist: pytest-asyncio ; extra == 'dev'
  33. Requires-Dist: tox ; extra == 'dev'
  34. ===========
  35. pytest-mock
  36. ===========
  37. This plugin provides a ``mocker`` fixture which is a thin-wrapper around the patching API
  38. provided by the `mock package <http://pypi.python.org/pypi/mock>`_:
  39. .. code-block:: python
  40. import os
  41. class UnixFS:
  42. @staticmethod
  43. def rm(filename):
  44. os.remove(filename)
  45. def test_unix_fs(mocker):
  46. mocker.patch('os.remove')
  47. UnixFS.rm('file')
  48. os.remove.assert_called_once_with('file')
  49. Besides undoing the mocking automatically after the end of the test, it also provides other
  50. nice utilities such as ``spy`` and ``stub``, and uses pytest introspection when
  51. comparing calls.
  52. |python| |version| |anaconda| |docs| |ci| |coverage| |black| |pre-commit|
  53. .. |version| image:: http://img.shields.io/pypi/v/pytest-mock.svg
  54. :target: https://pypi.python.org/pypi/pytest-mock
  55. .. |anaconda| image:: https://img.shields.io/conda/vn/conda-forge/pytest-mock.svg
  56. :target: https://anaconda.org/conda-forge/pytest-mock
  57. .. |ci| image:: https://github.com/pytest-dev/pytest-mock/workflows/test/badge.svg
  58. :target: https://github.com/pytest-dev/pytest-mock/actions
  59. .. |coverage| image:: https://coveralls.io/repos/github/pytest-dev/pytest-mock/badge.svg?branch=master
  60. :target: https://coveralls.io/github/pytest-dev/pytest-mock?branch=master
  61. .. |python| image:: https://img.shields.io/pypi/pyversions/pytest-mock.svg
  62. :target: https://pypi.python.org/pypi/pytest-mock/
  63. .. |black| image:: https://img.shields.io/badge/code%20style-black-000000.svg
  64. :target: https://github.com/ambv/black
  65. .. |pre-commit| image:: https://results.pre-commit.ci/badge/github/pytest-dev/pytest-mock/master.svg
  66. :target: https://results.pre-commit.ci/latest/github/pytest-dev/pytest-mock/master
  67. .. |docs| image:: https://readthedocs.org/projects/pytest-mock/badge/?version=latest
  68. :target: https://pytest-mock.readthedocs.io/en/latest/?badge=latest
  69. `Professionally supported pytest-mock is available <https://tidelift.com/subscription/pkg/pypi-pytest_mock?utm_source=pypi-pytest-mock&utm_medium=referral&utm_campaign=readme>`_.
  70. Documentation
  71. =============
  72. For full documentation, please see https://pytest-mock.readthedocs.io/en/latest.
  73. License
  74. =======
  75. Distributed under the terms of the `MIT`_ license.
  76. .. _MIT: https://github.com/pytest-dev/pytest-mock/blob/master/LICENSE