mockito


Namemockito JSON
Version 1.5.3 PyPI version JSON
download
home_pageNone
SummarySpying framework
upload_time2024-11-09 00:46:17
maintainerNone
docs_urlNone
authorNone
requires_python>=3.7
licenseMIT
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/28/84/88ee894d53d805e246a2bdb76110644999793ecd9a004ed5e9dd777b9899/mockito-1.5.3.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.3",
    "project_urls": null,
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "bd02992b22a48ca26cf11afe368f47af106d34634926dc74b2556082d102fb36",
                "md5": "d6a3314c02a0f2730215d5bd2190e182",
                "sha256": "094a5e7ebd140e6b5dcb0fc581f83616000f2b1311facc3b5e6167b906b52955"
            },
            "downloads": -1,
            "filename": "mockito-1.5.3-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "d6a3314c02a0f2730215d5bd2190e182",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7",
            "size": 30154,
            "upload_time": "2024-11-09T00:46:17",
            "upload_time_iso_8601": "2024-11-09T00:46:17.042672Z",
            "url": "https://files.pythonhosted.org/packages/bd/02/992b22a48ca26cf11afe368f47af106d34634926dc74b2556082d102fb36/mockito-1.5.3-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "288488ee894d53d805e246a2bdb76110644999793ecd9a004ed5e9dd777b9899",
                "md5": "e66a5f1179bcd90e870ca177e59b2a2c",
                "sha256": "b7192840e7d70ec24639cc5e18efee5d418c83ad86c0fd2bf7e71c3e42ae0aa7"
            },
            "downloads": -1,
            "filename": "mockito-1.5.3.tar.gz",
            "has_sig": false,
            "md5_digest": "e66a5f1179bcd90e870ca177e59b2a2c",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7",
            "size": 58698,
            "upload_time": "2024-11-09T00:46:17",
            "upload_time_iso_8601": "2024-11-09T00:46:17.999084Z",
            "url": "https://files.pythonhosted.org/packages/28/84/88ee894d53d805e246a2bdb76110644999793ecd9a004ed5e9dd777b9899/mockito-1.5.3.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-11-09 00:46:17",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "mockito"
}
        
Elapsed time: 0.43368s