Name | mockito JSON |
Version |
1.5.1
JSON |
| download |
home_page | None |
Summary | Spying framework |
upload_time | 2024-09-04 10:59:25 |
maintainer | None |
docs_url | None |
author | None |
requires_python | >=3.7 |
license | MIT |
keywords |
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
Mockito is a spying framework originally based on `the Java library with the same name
<https://github.com/mockito/mockito>`_. (Actually *we* invented the strict stubbing mode
back in 2009.)
.. image:: https://github.com/kaste/mockito-python/actions/workflows/test-lint-go.yml/badge.svg
:target: https://github.com/kaste/mockito-python/actions/workflows/test-lint-go.yml
Install
=======
``pip install mockito``
Quick Start
===========
90% use case is that you want to stub out a side effect.
::
from mockito import when, mock, unstub
when(os.path).exists('/foo').thenReturn(True)
# or:
import requests # the famous library
# you actually want to return a Response-like obj, we'll fake it
response = mock({'status_code': 200, 'text': 'Ok'})
when(requests).get(...).thenReturn(response)
# use it
requests.get('http://google.com/')
# clean up
unstub()
Read the docs
=============
http://mockito-python.readthedocs.io/en/latest/
Development
===========
I use `rye <https://rye-up.com/>`_, and if you do too: you just clone this repo
to your computer, then run ``rye sync`` in the root directory. Finally, activate
the virtualenv. (``rye shell`` gives you a hint on how to do that.)
::
pytest
Raw data
{
"_id": null,
"home_page": null,
"name": "mockito",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.7",
"maintainer_email": null,
"keywords": null,
"author": null,
"author_email": "herr kaste <herr.kaste@gmail.com>",
"download_url": "https://files.pythonhosted.org/packages/64/f7/8e8c33380dd56769ffa6a585466de04b7930fce3806515743902fa332e13/mockito-1.5.1.tar.gz",
"platform": null,
"description": "Mockito is a spying framework originally based on `the Java library with the same name\n<https://github.com/mockito/mockito>`_. (Actually *we* invented the strict stubbing mode\nback in 2009.) \n\n.. image:: https://github.com/kaste/mockito-python/actions/workflows/test-lint-go.yml/badge.svg\n :target: https://github.com/kaste/mockito-python/actions/workflows/test-lint-go.yml\n\n\nInstall\n=======\n\n``pip install mockito``\n\n\n\nQuick Start\n===========\n\n90% use case is that you want to stub out a side effect.\n\n::\n\n from mockito import when, mock, unstub\n\n when(os.path).exists('/foo').thenReturn(True)\n\n # or:\n import requests # the famous library\n # you actually want to return a Response-like obj, we'll fake it\n response = mock({'status_code': 200, 'text': 'Ok'})\n when(requests).get(...).thenReturn(response)\n\n # use it\n requests.get('http://google.com/')\n\n # clean up\n unstub()\n\n\n\n\nRead the docs\n=============\n\nhttp://mockito-python.readthedocs.io/en/latest/\n\n\n\nDevelopment\n===========\n\nI use `rye <https://rye-up.com/>`_, and if you do too: you just clone this repo\nto your computer, then run ``rye sync`` in the root directory. Finally, activate\nthe virtualenv. (``rye shell`` gives you a hint on how to do that.)\n\n::\n\n pytest\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Spying framework",
"version": "1.5.1",
"project_urls": null,
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "07c3ab6def638c0b3591907380df8418e6584186c1d24ac9511d73d9cd8e2c9b",
"md5": "f2eb7aed03c19de454e9a02e1deee8bd",
"sha256": "218c695baaf8e27980a263c9c1c4efb60ae8bbaf171be28558ec7ef3dae1ead3"
},
"downloads": -1,
"filename": "mockito-1.5.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "f2eb7aed03c19de454e9a02e1deee8bd",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.7",
"size": 30192,
"upload_time": "2024-09-04T10:59:23",
"upload_time_iso_8601": "2024-09-04T10:59:23.549334Z",
"url": "https://files.pythonhosted.org/packages/07/c3/ab6def638c0b3591907380df8418e6584186c1d24ac9511d73d9cd8e2c9b/mockito-1.5.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "64f78e8c33380dd56769ffa6a585466de04b7930fce3806515743902fa332e13",
"md5": "9bfb13a10be50b12ce5ed6834f92041b",
"sha256": "405624091715cc3954e2fa39cc50e508d59778d4d2fb56c8db7bfa5f593d3303"
},
"downloads": -1,
"filename": "mockito-1.5.1.tar.gz",
"has_sig": false,
"md5_digest": "9bfb13a10be50b12ce5ed6834f92041b",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.7",
"size": 58453,
"upload_time": "2024-09-04T10:59:25",
"upload_time_iso_8601": "2024-09-04T10:59:25.213125Z",
"url": "https://files.pythonhosted.org/packages/64/f7/8e8c33380dd56769ffa6a585466de04b7930fce3806515743902fa332e13/mockito-1.5.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-09-04 10:59:25",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "mockito"
}