{ "info": { "author": "Nicolas Gelot", "author_email": "nicolas.gelot@vadesecure.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 5 - Production/Stable", "Framework :: Pytest", "Intended Audience :: Developers", "Operating System :: MacOS :: MacOS X", "Operating System :: Microsoft :: Windows", "Operating System :: POSIX", "Programming Language :: Python", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7", "Topic :: Software Development :: Quality Assurance", "Topic :: Software Development :: Testing", "Topic :: Utilities" ], "description": "# pytest-dockerc\n\n**pytest-dockerc** is a plugin for [pytest](https://docs.pytest.org/en/latest/) that provides support\nfor running test from [Docker Compose](https://github.com/docker/compose#docker-compose) project.\nThe `docker-compose up -d` command is executed at the beginning of the\ntest session and the `docker-compose down` command at the end. The main fixture `dockerc`\nreturns a [compose.project.Project](https://github.com/docker/compose/blob/master/compose/project.py)\nto deal with the python docker API in your tests. Another fixture `dockerc_logs` is provided to enable\nthe logs on stdout during your tests execution.\n\nThis plugin provides a way to use as far as possible the same environment for development, test,\nintegration and production phases. You test and deploy the same artifact in order to avoid\nside effects in production.\n\n# Install\n\n```\npip install pytest-dockerc\n```\n\n# Getting started\n\nBelow a basic example, you can also refer to a full example with an\n[http server](https://gitlab.com/nicofonk/pytest-dockerc/blob/master/tests/test_fixtures.py).\n\n## worktree\n\n```\n\u251c\u2500\u2500 docker-compose.yml\n\u2514\u2500\u2500 tests\n \u251c\u2500\u2500 conftest.py\n \u2514\u2500\u2500 test_example.py\n```\n\n## docker-compose.yml\n\n```yaml\nversion: \"3.6\"\n\nservices:\n python:\n image: python:3-alpine\n```\n\n## test_example.py\n\n```python\ndef test_example(dockerc):\n assert len(dockerc.containers()) == 1\n container = dockerc.containers()[0]\n assert container.is_running is True\n assert container.labels[\"com.docker.compose.service\"] == \"python\"\n```\n\n# Available options\n\nSome options are available to update the default behavior of the plugin.\n\n```\ndockerc:\n --dockerc-norun disable the run and stop commands of docker-compose\n --dockerc-attach-network\n attach the pytest container to the docker-compose\n network,only if pytest is started inside a container\n --dockerc-filepath=DOCKERC_FILEPATH\n set the Compose file path\n --dockerc-projectdir=DOCKERC_PROJECTDIR\n set the working directory of the Compose project\n --dockerc-projectname=DOCKERC_PROJECTNAME\n set project name of the Compose project\n --dockerc-build build images before starting containers\n --dockerc-services=DOCKERC_SERVICES\n select services to run\n```\n\n## Run tests without up and down command of **docker-compose**\n\nRunning the full **docker-compose** project can take time, if you loads several services. It is\nuseful to run the test on a running instance. That method is recommended when you write a new\ntest.\n\nFirst start your docker compose like usual:\n```\ndocker-compose up\n```\n\nThen run your tests with the `--dockerc-norun`, that will skip the `up` and `down` command:\n```\npytest --dockerc-norun\n```\n\nBelow the docker-compose output after 2 runs of the test `tests/test_fixtures::test_basic_workflow`,\nwhich performs a GET request.\n```\nCreating network \"pytest-dockerc_default\" with the default driver\nCreating pytest-dockerc_http_1 ... done\nAttaching to pytest-dockerc_http_1\nhttp_1 | 192.168.32.1 - - [24/Dec/2018:08:48:21 +0000] \"GET / HTTP/1.1\" 200 612 \"-\" \"python-requests/2.20.0\" \"-\"\nhttp_1 | 192.168.32.1 - - [24/Dec/2018:08:48:22 +0000] \"GET / HTTP/1.1\" 200 612 \"-\" \"python-requests/2.20.0\" \"-\"\n\n```\n\n\n", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://gitlab.com/nicofonk/pytest-dockerc", "keywords": "py.test pytest docker docker-compose container", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "pytest-dockerc", "package_url": "https://pypi.org/project/pytest-dockerc/", "platform": "", "project_url": "https://pypi.org/project/pytest-dockerc/", "project_urls": { "Homepage": "https://gitlab.com/nicofonk/pytest-dockerc" }, "release_url": "https://pypi.org/project/pytest-dockerc/1.0.5/", "requires_dist": [ "pytest (>=3.0)", "docker-compose (>=1.17.1)", "requests ; extra == 'tests'" ], "requires_python": "", "summary": "Run, manage and stop Docker Compose project from Docker API", "version": "1.0.5" }, "last_serial": 4685302, "releases": { "1.0.2": [ { "comment_text": "", "digests": { "md5": "efaa77427dc6c16926eed5b5dc2be932", "sha256": "acb80809cbb5dfcd404b71626b721db94debd0adc2a00748a2b471dfada7bcdc" }, "downloads": -1, "filename": "pytest_dockerc-1.0.2-py3-none-any.whl", "has_sig": false, "md5_digest": "efaa77427dc6c16926eed5b5dc2be932", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 5907, "upload_time": "2018-12-27T16:49:43", "url": "https://files.pythonhosted.org/packages/74/7c/c22064164071bc267b9c601c4ef7730032a6ce840760eae98bd16fd16647/pytest_dockerc-1.0.2-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "439eb5af402fbb5612359aeaaf96ed88", "sha256": "c3c7ed5d1588d3b2a7f6b1b8a902fca4c1ba07cafe90d9745418770700d5f0ac" }, "downloads": -1, "filename": "pytest-dockerc-1.0.2.tar.gz", "has_sig": false, "md5_digest": "439eb5af402fbb5612359aeaaf96ed88", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6373, "upload_time": "2018-12-27T16:49:45", "url": "https://files.pythonhosted.org/packages/b8/0e/e36891450212ff3c6c157014ccb9370aed62ad35999b8739344a68237cf7/pytest-dockerc-1.0.2.tar.gz" } ], "1.0.3": [ { "comment_text": "", "digests": { "md5": "94754d41deeaea0abbbf2e68a8bb6504", "sha256": "cc6e5420a7dd45a61aef8279c6f5ea2a40d4d927f282e598dc6f6a549e8e4f65" }, "downloads": -1, "filename": "pytest_dockerc-1.0.3-py3-none-any.whl", "has_sig": false, "md5_digest": "94754d41deeaea0abbbf2e68a8bb6504", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 6364, "upload_time": "2018-12-28T13:24:42", "url": "https://files.pythonhosted.org/packages/58/23/17dbc03d50d7d6495eee578464c4ee861abbd30bcca5757edc872c55c4df/pytest_dockerc-1.0.3-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "080ce1f1090ad5f538017d7de3c0b724", "sha256": "fe5806d8acfe946d53d635b78c3de6ca0b20c5470292f8e683ac64936f290306" }, "downloads": -1, "filename": "pytest-dockerc-1.0.3.tar.gz", "has_sig": false, "md5_digest": "080ce1f1090ad5f538017d7de3c0b724", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6652, "upload_time": "2018-12-28T13:24:43", "url": "https://files.pythonhosted.org/packages/4f/f6/58139d4badd3d6279bbce244f8cd4985b46b42ad66aca189fa46218f33d1/pytest-dockerc-1.0.3.tar.gz" } ], "1.0.4": [ { "comment_text": "", "digests": { "md5": "4ba676e29e8baffbf67ee55817e2505f", "sha256": "49b5b83c6442a8d33587423b2fc1546d2e9b80f6af915848438269f65b4026f9" }, "downloads": -1, "filename": "pytest_dockerc-1.0.4-py3-none-any.whl", "has_sig": false, "md5_digest": "4ba676e29e8baffbf67ee55817e2505f", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 6541, "upload_time": "2019-01-08T10:30:59", "url": "https://files.pythonhosted.org/packages/4f/62/0f7741e41e6a85b251aa39054676194e8a72e2845ce3eb84bafea41ef389/pytest_dockerc-1.0.4-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "16dfc6c9113d0c6bd35bc08f543a6923", "sha256": "bbd257d84490f7afcea77317623be5117d49093d6a63aedec7cdacc6daff17e5" }, "downloads": -1, "filename": "pytest-dockerc-1.0.4.tar.gz", "has_sig": false, "md5_digest": "16dfc6c9113d0c6bd35bc08f543a6923", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7033, "upload_time": "2019-01-08T10:31:01", "url": "https://files.pythonhosted.org/packages/1f/e5/bf063bc71a8632eb35716e8b9015efce98f37cd286f1c355548d31d4ec6f/pytest-dockerc-1.0.4.tar.gz" } ], "1.0.5": [ { "comment_text": "", "digests": { "md5": "a58c1dae238b0a8febaeee68bb2bc9cd", "sha256": "8d706cfa6b8c28feb3a047980df335743758c603a6e8bc4fbd5162aec0eec63a" }, "downloads": -1, "filename": "pytest_dockerc-1.0.5-py3-none-any.whl", "has_sig": false, "md5_digest": "a58c1dae238b0a8febaeee68bb2bc9cd", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 7307, "upload_time": "2019-01-11T12:46:29", "url": "https://files.pythonhosted.org/packages/4c/77/cdad38874900b2c7e672ceef614f50e151fe04deb55f91b939c8fff35cdf/pytest_dockerc-1.0.5-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "8edc79b28a72ce1095cdadb3944ffa51", "sha256": "ed5c01902040cf48b47fd602e80104ef7307659c0d7963cfdd89a1ec39337854" }, "downloads": -1, "filename": "pytest-dockerc-1.0.5.tar.gz", "has_sig": false, "md5_digest": "8edc79b28a72ce1095cdadb3944ffa51", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7758, "upload_time": "2019-01-11T12:46:30", "url": "https://files.pythonhosted.org/packages/36/7a/9340a617d9e211f4a7321f7280c9f7222df21f6fd1b1ad61ae023050a6d3/pytest-dockerc-1.0.5.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "a58c1dae238b0a8febaeee68bb2bc9cd", "sha256": "8d706cfa6b8c28feb3a047980df335743758c603a6e8bc4fbd5162aec0eec63a" }, "downloads": -1, "filename": "pytest_dockerc-1.0.5-py3-none-any.whl", "has_sig": false, "md5_digest": "a58c1dae238b0a8febaeee68bb2bc9cd", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 7307, "upload_time": "2019-01-11T12:46:29", "url": "https://files.pythonhosted.org/packages/4c/77/cdad38874900b2c7e672ceef614f50e151fe04deb55f91b939c8fff35cdf/pytest_dockerc-1.0.5-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "8edc79b28a72ce1095cdadb3944ffa51", "sha256": "ed5c01902040cf48b47fd602e80104ef7307659c0d7963cfdd89a1ec39337854" }, "downloads": -1, "filename": "pytest-dockerc-1.0.5.tar.gz", "has_sig": false, "md5_digest": "8edc79b28a72ce1095cdadb3944ffa51", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7758, "upload_time": "2019-01-11T12:46:30", "url": "https://files.pythonhosted.org/packages/36/7a/9340a617d9e211f4a7321f7280c9f7222df21f6fd1b1ad61ae023050a6d3/pytest-dockerc-1.0.5.tar.gz" } ] }