{ "info": { "author": "Micha\u0142 Bultrowicz", "author_email": "michal.bultrowicz@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Intended Audience :: Developers", "License :: Freely Distributable", "Natural Language :: English", "Operating System :: POSIX :: Linux", "Programming Language :: Python :: 3.4" ], "description": "mountepy\n========\n\n.. image:: https://snap-ci.com/butla/mountepy/branch/master/build_image\n :target: https://snap-ci.com/butla/mountepy/branch/master\n.. image:: https://coveralls.io/repos/butla/mountepy/badge.svg?branch=master&service=github\n :target: https://coveralls.io/github/butla/mountepy?branch=master\n.. image:: https://requires.io/github/butla/mountepy/requirements.svg?branch=master\n :target: https://requires.io/github/butla/mountepy/requirements/?branch=master\n\nUtilities for creating HTTP (micro)service tests. Based on `Mountebank `_.\n\nMountepy works by spawning and cleaning after given HTTP service\nprocesses and Mountebank. Thanks to that you no longer need that \"start X\nbefore running the tests\" for your application. No. Your tests start\n\"X\", it's put up or down only when it needs to and as many times as you\nneed.\n\n- Test-framework-agnostic (use unittest, nose, py.test or whatever...\n but I like py.test).\n- Enables fast and reliable end-to-end testing of microservices. They\n won't be aware that they are in some testing mode.\n- Tested on Python 3.4, Ubuntu 14 x64.\n- Planned features in the road map below.\n If you have suggestions, just post them as Github issues.\n Pull requests are also welcome :)\n\nI recommend Pytest for elastic composition of service process test\nfixtures. Your process may start once per test suite, once per test,\netc.\n\nInstallation\n------------\n\n.. code-block:: bash\n\n $ pip install mountepy\n\nA standalone distribution of Mountebank (including NodeJS) will be\ndownloaded on first run.\n\nIf you don't want Mountepy to download Mountebank:\n\n1. Install NodeJS and NPM. On Ubuntu it's\n\n.. code-block:: bash\n\n $ sudo apt-get install -y nodejs-legacy npm\n\n2. Install Mountebank yourself\n\n.. code-block:: bash\n\n $ npm install -g mountebank --production\n\nExamples\n--------\n\nMountebank acts as a mock for external HTTP services.\nHere's how you spawn a Mountebank process, configure it with a stub\nof some HTTP service, assert that it's actually responding.\nMountebank process is killed after the ``with`` block.\n\n.. code-block:: python\n\n # requests is installed alongside Mountepy\n import mountepy, requests\n\n with mountepy.Mountebank() as mb:\n imposter = mb.add_imposter_simple(path='/something', response='mock response')\n stub_url = 'http://localhost:{}/something'.format(imposter.port)\n assert requests.get(stub_url).text == 'mock response'\n\nIt's a good idea to test your service as a whole process.\nLet's say that you have an one-file WSGI (e.g. Flask or Bottle) app\nthat responds to a ``GET`` on its root path (``'\\'``) with a string\nit sees in ``RET_STR`` environment variable.\nAlso, the app needs to know on what port to run, so we also pass it\nas an environment variable. ``{port}`` is a special value for Mountepy.\nIt will be filled with the application's port, whether it's passed\nduring object construction or automatically selected from free ports.\n\n.. code-block:: python\n\n # port_for is installed alongside Mountepy\n import mountepy, requests, port_for, os, sys\n\n service_port = port_for.select_random()\n service = mountepy.HttpService(\n [sys.executable, 'sample_app.py'],\n port=service_port,\n env={\n 'PORT': '{port}',\n 'RET_STR': 'Just some text.'\n })\n with service:\n assert requests.get(service.url).text == 'Just some text.'\n\nStarting a more complex service running on `Gunicorn `_\ncan look like this:\n\n.. code-block:: python\n\n import os, sys\n\n gunicorn_path = os.path.join(os.path.dirname(sys.executable), 'gunicorn')\n service_command = [\n gunicorn_path,\n 'your_package.app:get_app()',\n '--bind', ':{port}',\n '--enable-stdio-inheritance',\n '--pythonpath', ','.join(sys.path)]\n\n service = HttpService(service_command)\n\n # You can use start/stop methods instead of using the \"with\" statement.\n # It's the same for Mountebank objects.\n service.start()\n\n # now you test stuff...\n service.stop()\n\n\"Real world\" use of ``mountepy`` can be found in `PyDAS `_.\n\nMeasuring test coverage\n-----------------------\n\nMountepy starts your code in a separate process, so it's normally hard to get\ninformation about the code covered by the tests.\nFortunately, this problem is solved by `Coverage `_.\nSee `this documentation page `_.\n\nIn short, you need to:\n\n- run ``coverage.process_startup()`` in each new Python process \n (this can be enforced by installing ``coverage_pth``, but some caution is required)\n- set ``COVERAGE_PROCESS_START`` environment variable to location of your ``.coveragerc``\n- run the tests themselves: ``coverage run (...)``, ``coverage combine`` and then ``coverage report -m``\n\nAgain, see `PyDAS's tox.ini `_ for demonstration.\n\nRunning tests\n-------------\n\nClone the repo with submodules, then install and run tox.\n\n.. code-block:: bash\n\n $ git clone --recursive git@github.com:butla/mountepy.git\n $ sudo pip install tox\n $ cd mountepy\n $ tox\n\nMotivation (on 2015-12-30)\n--------------------------\n\n- Why `Mountebank `__? It can be\n deployed as standalone application, is actively developed and\n supports TCP mocks which can be used to simulate broken HTTP\n messages.\n- Why not `Pretenders `_?\n Doesn't support TCP and the development doesn't seem to be really\n active.\n- Why not `WireMock `_?\n Doesn't support TCP and I don't want to be forced to install Java to\n run tests and it doesn't seem to have more features than Mountebank.\n- Why create a new project? There already is a `Python Mountebank\n wrapper `_, but it\n doesn't offer much.\n\nLicense\n-------\nMountepy is licensed under `BSD Zero Clause license `_.\n\nWhy I didn't use one of the more popular licenses like MIT, 2 or 3-Clause BSD or Apache2? Well, this one is practically equal to 2-Clause BSD (and I don't see any functional differences between it and MIT license) with the exception of the rule about retaining the original license text in derivative work. So if you'd happen to redistribute my library along with your software you don't have to attach a copy of my license. So you won't break any copyright laws by being lazy (which I like to be, for instance). You're welcome.", "description_content_type": null, "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/butla/mountepy", "keywords": "test http mountebank microservice", "license": "BSD Zero Clause", "maintainer": "", "maintainer_email": "", "name": "mountepy", "package_url": "https://pypi.org/project/mountepy/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/mountepy/", "project_urls": { "Homepage": "https://github.com/butla/mountepy" }, "release_url": "https://pypi.org/project/mountepy/0.4.1/", "requires_dist": [ "port-for", "python-dateutil", "requests" ], "requires_python": "", "summary": "Utilities for creating (micro)service tests. Based on Mountebank.", "version": "0.4.1" }, "last_serial": 2664404, "releases": { "0.1.10": [ { "comment_text": "", "digests": { "md5": "8922b1d4996397318e1991aee0558c8d", "sha256": "a6700c46fb614b452b6f9f8a33916ccf4f0ebc30a5241ee60aa8ecd5d6161c2c" }, "downloads": -1, "filename": "mountepy-0.1.10-py3-none-any.whl", "has_sig": true, "md5_digest": "8922b1d4996397318e1991aee0558c8d", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 12885, "upload_time": "2016-01-31T20:44:18", "url": "https://files.pythonhosted.org/packages/05/0b/83b1ebc3598338824bdce7ddd7153cbe34edbd6ba3e09e44815eba925785/mountepy-0.1.10-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "88df9ee8c559f6ef7d6c82b9e0d3a882", "sha256": "aa2579da7f8c9ad2014e406562c2e7f3a776f46c2805300ccd40ab7fe0bbc805" }, "downloads": -1, "filename": "mountepy-0.1.10.tar.gz", "has_sig": true, "md5_digest": "88df9ee8c559f6ef7d6c82b9e0d3a882", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8729, "upload_time": "2016-01-31T20:45:19", "url": "https://files.pythonhosted.org/packages/02/5d/58e81333682be6b8083e81872c6c677161e48cca5c4de089f1588532b9b8/mountepy-0.1.10.tar.gz" } ], "0.2.0": [ { "comment_text": "", "digests": { "md5": "e843964bb09a90acb59710ce579a5938", "sha256": "57a59a8758d3af43e8f51016e875be525064a3f4ff250279ee8481949eedb334" }, "downloads": -1, "filename": "mountepy-0.2.0.linux-x86_64.tar.gz", "has_sig": false, "md5_digest": "e843964bb09a90acb59710ce579a5938", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 13206, "upload_time": "2016-03-20T17:10:21", "url": "https://files.pythonhosted.org/packages/f7/03/f6053a5799eb35634466a2b59e54b8e7b4481bc6fec92605efd72dbcc2f9/mountepy-0.2.0.linux-x86_64.tar.gz" }, { "comment_text": "", "digests": { "md5": "2113243f9926619d395d6aaf547c12ef", "sha256": "d20227b71c8d2724b4746e638d4afd3b22f5f9775bb99e98638c8e13e22c3c40" }, "downloads": -1, "filename": "mountepy-0.2.0.tar.gz", "has_sig": false, "md5_digest": "2113243f9926619d395d6aaf547c12ef", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8865, "upload_time": "2016-03-20T17:10:27", "url": "https://files.pythonhosted.org/packages/f3/19/0664dab4c760cb9ca64f7faa8a6b82dc08fb27c491658261781a8928861d/mountepy-0.2.0.tar.gz" } ], "0.2.1": [ { "comment_text": "", "digests": { "md5": "90bda1db9b10903b9a86ce1513fd670e", "sha256": "a6cfb2e1c2f3e10cc68e2caa99ba0f9d0029f0dbda994d9c441e03352b0ad6e5" }, "downloads": -1, "filename": "mountepy-0.2.1.linux-x86_64.tar.gz", "has_sig": false, "md5_digest": "90bda1db9b10903b9a86ce1513fd670e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 13227, "upload_time": "2016-03-21T21:00:55", "url": "https://files.pythonhosted.org/packages/6a/34/990f88fd7b984a2cf0133ec265a86191acadec33eca4cdb28b7b2cb15086/mountepy-0.2.1.linux-x86_64.tar.gz" }, { "comment_text": "", "digests": { "md5": "9e79b29139c6ab0132a717e7e6d58599", "sha256": "71bd5cfd10bf637a13263a50394613bed459fc24edc8614b11cceda091e121cc" }, "downloads": -1, "filename": "mountepy-0.2.1.tar.gz", "has_sig": false, "md5_digest": "9e79b29139c6ab0132a717e7e6d58599", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8875, "upload_time": "2016-03-21T21:01:03", "url": "https://files.pythonhosted.org/packages/b7/21/ccb2a4e5a331261967f5451b64a54a44d358c2a63c81700ee5329765cdb2/mountepy-0.2.1.tar.gz" } ], "0.3.0": [ { "comment_text": "", "digests": { "md5": "be3500bcc557428cbf2f5335a424162f", "sha256": "2f526e178807c833e98a563b69709063bda7cd631b29a5205567208c282a2bfb" }, "downloads": -1, "filename": "mountepy-0.3.0.linux-x86_64.tar.gz", "has_sig": false, "md5_digest": "be3500bcc557428cbf2f5335a424162f", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 13886, "upload_time": "2016-05-24T20:57:05", "url": "https://files.pythonhosted.org/packages/96/a3/b0ea0a266b7bd457d97f0ece7767ce554264fac0d000e55b0d4fe71df0d8/mountepy-0.3.0.linux-x86_64.tar.gz" }, { "comment_text": "", "digests": { "md5": "f25b0a475da3d8084277d2c7526d7890", "sha256": "96134e5bdb76d31dcea55af879a6aa5a69a105a44e7871dcae60816ca1cec4d2" }, "downloads": -1, "filename": "mountepy-0.3.0-py3-none-any.whl", "has_sig": false, "md5_digest": "f25b0a475da3d8084277d2c7526d7890", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 13515, "upload_time": "2016-07-06T12:10:27", "url": "https://files.pythonhosted.org/packages/97/f0/fc357ed7d91e15f322c4be2e9eccf60b62b61c3976ce3b34ff3c8ebdaf92/mountepy-0.3.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "2bf952dde935e496d89bdbbbcc8d4666", "sha256": "d4decf6cee90c6f7212faa43eff0e8295fe20092a75a1389df066b4045f822a8" }, "downloads": -1, "filename": "mountepy-0.3.0.tar.gz", "has_sig": false, "md5_digest": "2bf952dde935e496d89bdbbbcc8d4666", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9871, "upload_time": "2016-05-24T20:58:59", "url": "https://files.pythonhosted.org/packages/b7/d1/3bc8eecdf6c8cb435b3c98a14ae3a3d5a9e86aba5cb903fc617b528097ed/mountepy-0.3.0.tar.gz" } ], "0.3.1": [ { "comment_text": "", "digests": { "md5": "bed0989864140dd570dec7041879fceb", "sha256": "07783759bc847521c949b6a645e93b0743d665faf8d8497c234e92b63f98bf65" }, "downloads": -1, "filename": "mountepy-0.3.1-py3-none-any.whl", "has_sig": false, "md5_digest": "bed0989864140dd570dec7041879fceb", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 13338, "upload_time": "2016-07-09T10:30:13", "url": "https://files.pythonhosted.org/packages/dc/55/8a6d70eeec7ce89298a8143860337c2cb16429c8a26c5da21a74ab3f2fcb/mountepy-0.3.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "8afa5f8ac7b22e8e8ba456d92f858786", "sha256": "003c139919e35d581c0143892f4222f65219978d39359323ca9c580f8a865d45" }, "downloads": -1, "filename": "mountepy-0.3.1.tar.gz", "has_sig": false, "md5_digest": "8afa5f8ac7b22e8e8ba456d92f858786", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9734, "upload_time": "2016-07-09T10:30:18", "url": "https://files.pythonhosted.org/packages/bc/47/f11202ab29971112c677690855996651aa28d69cbb8d888855daf77c8b10/mountepy-0.3.1.tar.gz" } ], "0.3.2": [ { "comment_text": "", "digests": { "md5": "906e8fb9846f494abd3916c15ebbaffe", "sha256": "ef79fabe02e097fe502e9fb9898fa03a0adee3a427bf37606239756b77483bef" }, "downloads": -1, "filename": "mountepy-0.3.2-py3-none-any.whl", "has_sig": false, "md5_digest": "906e8fb9846f494abd3916c15ebbaffe", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 13324, "upload_time": "2016-07-09T12:31:06", "url": "https://files.pythonhosted.org/packages/6c/6b/6d48bc2477b7570ff3ee068bff700eb60e6fc1278c292a64740d94a41f11/mountepy-0.3.2-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "b41cc3c2c586bc43b2d36dee491fcd32", "sha256": "95a7c06f34799eddfc6dd9bdb635f3f07842a53fb917f45821921b9603ad81af" }, "downloads": -1, "filename": "mountepy-0.3.2.tar.gz", "has_sig": false, "md5_digest": "b41cc3c2c586bc43b2d36dee491fcd32", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9736, "upload_time": "2016-07-09T12:31:11", "url": "https://files.pythonhosted.org/packages/8d/fb/8c955db65473c41da4a271db48f1acc17e01b0a004b06b76391ee9482b1e/mountepy-0.3.2.tar.gz" } ], "0.3.3": [ { "comment_text": "", "digests": { "md5": "a75e5d19fa4cc0660bb1d517797ab783", "sha256": "82726c70504613e28580a3aee1fcc5d79bd6cb82ca03af0b5d657c097031544d" }, "downloads": -1, "filename": "mountepy-0.3.3-py3-none-any.whl", "has_sig": false, "md5_digest": "a75e5d19fa4cc0660bb1d517797ab783", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 13323, "upload_time": "2016-07-10T17:26:32", "url": "https://files.pythonhosted.org/packages/ec/83/f9cb5d23f6ea0659177d8c54a488d615a1d19820c55148aedb13d2cc4e50/mountepy-0.3.3-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "673d9992777280473e9fe71763ff397c", "sha256": "7404e362bb9a3320b4303e04f72e48a0686235d16860dddbb1e070a0d67b99b5" }, "downloads": -1, "filename": "mountepy-0.3.3.tar.gz", "has_sig": false, "md5_digest": "673d9992777280473e9fe71763ff397c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9621, "upload_time": "2016-07-10T17:26:36", "url": "https://files.pythonhosted.org/packages/7c/37/06b6b84fc6a911bc8258252c0e2adb81fa1bedbf75d8980e2faa210cce84/mountepy-0.3.3.tar.gz" } ], "0.4.0": [ { "comment_text": "", "digests": { "md5": "52508538f41ed6a83eccd01c4b51790d", "sha256": "ccd1a0a0a9ebb4e810d4466c9a7857e6a2b0e8aa3071914a6638f47f8eb7e528" }, "downloads": -1, "filename": "mountepy-0.4.0-py3-none-any.whl", "has_sig": false, "md5_digest": "52508538f41ed6a83eccd01c4b51790d", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 14487, "upload_time": "2016-10-26T14:07:33", "url": "https://files.pythonhosted.org/packages/09/ab/2d95a8af239a61f93964fb65706c4501025a2cc8ead9937aa355cd648829/mountepy-0.4.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "325a515856938d9933bf4608ef397788", "sha256": "00927dfb5267afc97299fd03e118a6d786d0c9a739c9ce445750c8f208d27e20" }, "downloads": -1, "filename": "mountepy-0.4.0.tar.gz", "has_sig": false, "md5_digest": "325a515856938d9933bf4608ef397788", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 13295, "upload_time": "2016-10-26T14:07:36", "url": "https://files.pythonhosted.org/packages/75/11/b3d2e3b94bd2310253f2281372f9d6e769de8b5e7a011a207885322a0697/mountepy-0.4.0.tar.gz" } ], "0.4.1": [ { "comment_text": "", "digests": { "md5": "d1e97b8b66736ded147d02bdc3b70760", "sha256": "54965f57c15f84af97156d1a7267115fc500d57b6b8389b41b545e715fd7b225" }, "downloads": -1, "filename": "mountepy-0.4.1-py3-none-any.whl", "has_sig": false, "md5_digest": "d1e97b8b66736ded147d02bdc3b70760", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 14351, "upload_time": "2017-02-23T21:48:01", "url": "https://files.pythonhosted.org/packages/ed/c5/014d2c0dff42da50d402611bd5bd5a56cf0ebc1a6488690dfde2ced62218/mountepy-0.4.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "c2507a119c29d6bd55a9e3c71a15e014", "sha256": "cb6e131996bb38b61dc7b0bf45d7459a4ba9c918214bd8a4b47108a8c1bff920" }, "downloads": -1, "filename": "mountepy-0.4.1.tar.gz", "has_sig": false, "md5_digest": "c2507a119c29d6bd55a9e3c71a15e014", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 12305, "upload_time": "2017-02-23T21:48:05", "url": "https://files.pythonhosted.org/packages/87/72/61ff89ec79b2ea70eb05b86c3bd186b5e4802c601dc3b952977b946ed22a/mountepy-0.4.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "d1e97b8b66736ded147d02bdc3b70760", "sha256": "54965f57c15f84af97156d1a7267115fc500d57b6b8389b41b545e715fd7b225" }, "downloads": -1, "filename": "mountepy-0.4.1-py3-none-any.whl", "has_sig": false, "md5_digest": "d1e97b8b66736ded147d02bdc3b70760", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 14351, "upload_time": "2017-02-23T21:48:01", "url": "https://files.pythonhosted.org/packages/ed/c5/014d2c0dff42da50d402611bd5bd5a56cf0ebc1a6488690dfde2ced62218/mountepy-0.4.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "c2507a119c29d6bd55a9e3c71a15e014", "sha256": "cb6e131996bb38b61dc7b0bf45d7459a4ba9c918214bd8a4b47108a8c1bff920" }, "downloads": -1, "filename": "mountepy-0.4.1.tar.gz", "has_sig": false, "md5_digest": "c2507a119c29d6bd55a9e3c71a15e014", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 12305, "upload_time": "2017-02-23T21:48:05", "url": "https://files.pythonhosted.org/packages/87/72/61ff89ec79b2ea70eb05b86c3bd186b5e4802c601dc3b952977b946ed22a/mountepy-0.4.1.tar.gz" } ] }