{ "info": { "author": "Ciotto", "author_email": "info@ci8.it", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Natural Language :: English", "Operating System :: OS Independent", "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.6", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Topic :: Software Development :: Testing" ], "description": "# Input-Mocker\n\n[![Build Status](https://travis-ci.org/ciotto/input-mocker.svg?branch=master)](https://travis-ci.org/ciotto/input-mocker)\n[![Codecov](https://codecov.io/gh/ciotto/input-mocker/branch/master/graph/badge.svg)](https://codecov.io/gh/ciotto/input-mocker)\n[![Version](https://badge.fury.io/py/input-mocker.svg)](https://badge.fury.io/py/input-mocker)\n[![Py Versions](https://img.shields.io/pypi/pyversions/input-mocker.svg)](https://pypi.python.org/pypi/input-mocker/)\n[![License](https://img.shields.io/pypi/l/input-mocker.svg)](https://pypi.python.org/pypi/input-mocker/)\n[![Status](https://img.shields.io/pypi/status/input-mocker.svg)](https://pypi.python.org/pypi/input-mocker/)\n[![PEP8](https://img.shields.io/badge/code%20style-pep8-orange.svg)](https://www.python.org/dev/peps/pep-0008/)\n\n**input-mocker** is *simple* and *easy-to-use* tool for mocking of prompt functions.\n\nYou can mock call to a `sys.stdin.readline in order to programmatically send user input.\n\n\n## Installation\n\nYou can install **input-mocker** from *PyPi*:\n\n`pip install input-mocker`\n\nor from GitHub:\n\n`pip install https://github.com/ciotto/input-mocker/archive/master.zip`\n\n\n## Usage\n\nUsing **input-mocker** is easy:\n\n```\n>>> from input_mocker import InputMocker\n>>> with InputMocker():\n... raw_input() # Or input() for Python3\n... raw_input()\n... raw_input()\n... raw_input()\n... \n'y'\n'n'\n'y'\n'n'\n```\n\nBy default **input-mocker** send alternated 'y'/'n' response.\n\nIf you want to get random response initialize instance with `random=True` paramiter:\n\n```\n>>> from input_mocker import InputMocker\n>>> with InputMocker(random=True):\n... raw_input()\n... raw_input()\n... raw_input()\n... raw_input()\n... \n'y'\n'y'\n'n'\n'y'\n```\n\nIs also possible to use a customized set of inputs:\n\n```\n>>> with InputMocker(inputs=['Foo', '42']):\n... raw_input('A question: ')\n... raw_input('What's the ultimate answer to life, the universe, and everything? ')\n... \nQuestion: 'Foo'\nWhat's the ultimate answer to life, the universe, and everything? '42'\n```\n\nSometimes probably you'll prefer to use the decorator:\n\n```\n>>> import input_mocker\n>>> @input_mocker.patch(random=True)\n... def my_method():\n... print(raw_input('question 1: '))\n... print(raw_input('question 2: '))\n... print(raw_input('question 3: '))\n... print(raw_input('question 4: '))\n... \n>>> my_method()\nquestion 1: y\nquestion 1: y\nquestion 1: y\nquestion 1: n\n```\n\n**input-mocker** work with `sys.stdin.readline()`, `input()` and `raw_input()`.\n\n\n## How to contribute\n\nThis is not a big library but if you want to contribute is very easy!\n\n 1. clone the repository `git clone https://github.com/ciotto/input-mocker.git`\n 1. install all requirements `make init`\n 1. do your fixes or add new awesome features (with tests)\n 1. run the tests `make test`\n 1. commit in new branch and make a pull request\n\n\n---\n\n\n## License\n\nReleased under [MIT License](https://github.com/ciotto/input-mocker/blob/master/LICENSE.txt).", "description_content_type": "", "docs_url": null, "download_url": "https://github.com/ciotto/input-mocker/archive/v0.1.4.tar.gz", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/ciotto/input-mocker", "keywords": "tests,prompt,input,raw_input,mock", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "input-mocker", "package_url": "https://pypi.org/project/input-mocker/", "platform": "", "project_url": "https://pypi.org/project/input-mocker/", "project_urls": { "Download": "https://github.com/ciotto/input-mocker/archive/v0.1.4.tar.gz", "Homepage": "https://github.com/ciotto/input-mocker" }, "release_url": "https://pypi.org/project/input-mocker/0.1.4/", "requires_dist": null, "requires_python": "", "summary": "input-mocker is simple and easy-to-use tool for mocking of prompt functions.", "version": "0.1.4" }, "last_serial": 3711397, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "e1ff6acf0e6f031838bae70ec0ab9b1f", "sha256": "7a094580d25c73af3b30cff37d4607a148e4dfd7bbba4876edca5125a9e8dca1" }, "downloads": -1, "filename": "input-mocker-0.1.0.macosx-10.11-x86_64.tar.gz", "has_sig": false, "md5_digest": "e1ff6acf0e6f031838bae70ec0ab9b1f", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4294, "upload_time": "2018-03-20T23:44:33", "url": "https://files.pythonhosted.org/packages/78/7f/2c69acaea1ab6585ecd6031337ff7223a7085f7ab5b58a812cc2216c1e14/input-mocker-0.1.0.macosx-10.11-x86_64.tar.gz" } ], "0.1.1": [ { "comment_text": "", "digests": { "md5": "2a6eec12a71580420dfbd9a7891d0763", "sha256": "3426cd3b43b3e1377e56aed396cb44649ce6cc6b63555b9255021cfdaf2fc657" }, "downloads": -1, "filename": "input-mocker-0.1.1.macosx-10.11-x86_64.tar.gz", "has_sig": false, "md5_digest": "2a6eec12a71580420dfbd9a7891d0763", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4421, "upload_time": "2018-03-21T01:48:43", "url": "https://files.pythonhosted.org/packages/78/64/deed27b4f1cd935d8fd5252ea0f896facb5a1d6343a57a60534fae09ce4e/input-mocker-0.1.1.macosx-10.11-x86_64.tar.gz" } ], "0.1.2": [ { "comment_text": "", "digests": { "md5": "b6dd2483b44863f3f4d60f2861963a8a", "sha256": "1f6913b1d8ada70cf2aa8647067dde1c8dd38aea5323b7dd12f150c22dad85d3" }, "downloads": -1, "filename": "input-mocker-0.1.2.tar.gz", "has_sig": false, "md5_digest": "b6dd2483b44863f3f4d60f2861963a8a", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3491, "upload_time": "2018-03-24T08:50:04", "url": "https://files.pythonhosted.org/packages/80/0f/380717e387d96f71ac812130b038e9759c5f3ffb5ef70287175c2f101434/input-mocker-0.1.2.tar.gz" } ], "0.1.3": [ { "comment_text": "", "digests": { "md5": "bde1d1f608f28e5c9700cfab7cf29294", "sha256": "06f6628b579c9bff4c1860335551e4bb1befb660e64ad05abc970486b5808bc0" }, "downloads": -1, "filename": "input-mocker-0.1.3.tar.gz", "has_sig": false, "md5_digest": "bde1d1f608f28e5c9700cfab7cf29294", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3572, "upload_time": "2018-03-27T17:15:42", "url": "https://files.pythonhosted.org/packages/f0/81/e32affa864386a4530755742e1206d73bc79c4e2f1a8acabd4599cb3ff30/input-mocker-0.1.3.tar.gz" } ], "0.1.4": [ { "comment_text": "", "digests": { "md5": "3de9aba79ec6abf895fb2872ca18b8aa", "sha256": "c5025c53b46c556651788a69a94252d02f5868821a038f3965477cc03abeef9c" }, "downloads": -1, "filename": "input-mocker-0.1.4.tar.gz", "has_sig": false, "md5_digest": "3de9aba79ec6abf895fb2872ca18b8aa", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3553, "upload_time": "2018-03-27T19:13:22", "url": "https://files.pythonhosted.org/packages/43/0a/e7c04b3225ac2cbae53ed2182fdc6d3325df29239af895ce3967d156ee72/input-mocker-0.1.4.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "3de9aba79ec6abf895fb2872ca18b8aa", "sha256": "c5025c53b46c556651788a69a94252d02f5868821a038f3965477cc03abeef9c" }, "downloads": -1, "filename": "input-mocker-0.1.4.tar.gz", "has_sig": false, "md5_digest": "3de9aba79ec6abf895fb2872ca18b8aa", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3553, "upload_time": "2018-03-27T19:13:22", "url": "https://files.pythonhosted.org/packages/43/0a/e7c04b3225ac2cbae53ed2182fdc6d3325df29239af895ce3967d156ee72/input-mocker-0.1.4.tar.gz" } ] }