{ "info": { "author": "Henning Jacobs", "author_email": "henning@jacobs1.de", "bugtrack_url": null, "classifiers": [ "Framework :: Pytest", "License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.7" ], "description": "# pytest-kind\n\n[![Build Status](https://travis-ci.com/hjacobs/pytest-kind.svg?branch=master)](https://travis-ci.com/hjacobs/pytest-kind)\n[![PyPI](https://img.shields.io/pypi/v/pytest-kind)](https://pypi.org/project/pytest-kind/)\n![PyPI - Python Version](https://img.shields.io/pypi/pyversions/pytest-kind)\n![License](https://img.shields.io/github/license/hjacobs/pytest-kind)\n![CalVer](https://img.shields.io/badge/calver-YY.MM.MICRO-22bfda.svg)\n\nTest your Python Kubernetes app/operator end-to-end with [kind](https://kind.sigs.k8s.io/) and [pytest](https://pytest.org).\n\n`pytest-kind` is a plugin for pytest which provides the `kind_cluster` fixture.\nThe fixture will install kind 0.5.1, create a Kubernetes 1.15 cluster, and provide convenience functionality such as port forwarding.\n\n\n## Usage\n\nInstall `pytest-kind` via pip or via [poetry](https://poetry.eustace.io/), e.g.:\n\n```\npoetry add --dev pytest-kind\n```\n\nWrite your pytest functions and use the provided `kind_cluster` fixture, e.g.:\n\n```python\ndef test_kubernetes_version(kind_cluster):\n assert kind_cluster.api.version == ('1', '15')\n```\n\nTo load your custom Docker image and apply deployment manifests:\n\n```python\nimport requests\nfrom pykube import Pod\n\ndef test_myapp(kind_cluster):\n kind_cluster.load_docker_image(\"myapp\")\n kind_cluster.kubectl(\"apply\", \"-f\", \"deployment.yaml\")\n kind_cluster.kubectl(\"rollout\", \"status\", \"deployment/myapp\")\n\n # using Pykube to query pods\n for pod in Pod.objects(kind_cluster.api).filter(selector=\"app=myapp\"):\n assert \"Sucessfully started\" in pod.logs()\n\n with kind_cluster.port_forward(\"service/myapp\", 80) as port:\n r = requests.get(f\"http://localhost:{port}/hello/world\")\n r.raise_for_status()\n assert r.text == \"Hello world!\"\n```\n\nSee the `examples` directory for sample projects and also check out [kube-web-view](https://codeberg.org/hjacobs/kube-web-view) which uses pytest-kind for its e2e tests.\n\n\n## KindCluster object\n\nThe `kind_cluster` fixture is an instance of the KindCluster class with the following methods:\n\n* `load_docker_image(docker_image)`: load the specified Docker image into the kind cluster\n* `kubectl(*args)`: run the `kubectl` binary against the cluster with the specified arguments. Returns the process output as string.\n* `port_forward(service_or_pod_name, remote_port, *args)`: run \"kubectl port-forward\" for the given service/pod and return the (random) local port. To be used as context manager (\"with\" statement). Pass the namespace as additional args to kubectl via \"-n\", \"mynamespace\".\n\nKindCluster has the following attributes:\n\n* `name`: the kind cluster name\n* `kubeconfig_path`: the path to the Kubeconfig file to access the cluster\n* `kind_path`: path to the `kind` binary\n* `kubectl_path`: path to the `kubectl` binary\n* `api`: [pykube](https://pykube.readthedocs.io/) HTTPClient instance to access the cluster from Python\n\nYou can also use KindCluster directly without pytest:\n\n```python\nfrom pytest_kind import KindCluster\n\ncluster = KindCluster(\"myclustername\")\ncluster.create()\ncluster.kubectl(\"apply\", \"-f\", \"..\")\n# ...\ncluster.delete()\n```\n\n\n## Pytest Options\n\nThe kind cluster name can be set via the `--cluster-name` CLI option.\n\nThe kind cluster is deleted after each pytest session, you can keep the cluster by passing `--keep-cluster` to pytest.\n\n\n## Notes\n\n* The `kind_cluster` fixture is session-scoped, i.e. the same cluster will be used across all test modules/functions.\n* The `kind` and `kubectl` binaries will be downloaded once to the local directory `./.pytest-kind/{cluster-name}/`. You can use them to interact with the cluster (e.g. when `--keep-cluster` is used).\n* Some cluster pods might not be ready immediately (e.g. kind's CoreDNS take a moment), add wait/poll functionality as required to make your tests predictable.\n", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://codeberg.org/hjacobs/pytest-kind", "keywords": "", "license": "GPL-3.0+", "maintainer": "Henning Jacobs", "maintainer_email": "henning@jacobs1.de", "name": "pytest-kind", "package_url": "https://pypi.org/project/pytest-kind/", "platform": "", "project_url": "https://pypi.org/project/pytest-kind/", "project_urls": { "Homepage": "https://codeberg.org/hjacobs/pytest-kind", "Repository": "https://codeberg.org/hjacobs/pytest-kind" }, "release_url": "https://pypi.org/project/pytest-kind/19.9.1/", "requires_dist": [ "pykube-ng (>=0.30.0)" ], "requires_python": ">=3.7,<4.0", "summary": "Kubernetes test support with KIND for pytest", "version": "19.9.1" }, "last_serial": 5776860, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "433fdcc5e8d0c120b293e68fa343a67e", "sha256": "0d802a1d6398246c7b650f9151b0c6195dfc3ba762cc5252930eacbbf609a8c5" }, "downloads": -1, "filename": "pytest_kind-0.1.0-py3-none-any.whl", "has_sig": false, "md5_digest": "433fdcc5e8d0c120b293e68fa343a67e", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.7,<4.0", "size": 2609, "upload_time": "2019-08-31T14:05:56", "url": "https://files.pythonhosted.org/packages/43/30/a51c770cb8197bd42c8d5c941ba542ecdbc3619ce40b37bd04142dd379a0/pytest_kind-0.1.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "5c1615dfe4e1fee2d7c95f76f93f8103", "sha256": "a4cab7370f94fc99e5403a2fe34b9a8a59e55878b6b686c929080c9313960d51" }, "downloads": -1, "filename": "pytest-kind-0.1.0.tar.gz", "has_sig": false, "md5_digest": "5c1615dfe4e1fee2d7c95f76f93f8103", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.7,<4.0", "size": 2168, "upload_time": "2019-08-31T14:05:54", "url": "https://files.pythonhosted.org/packages/8d/91/3ecd0d3f224a2b74c359f5689a46c1f4160c6338e6370c5140c724d9c768/pytest-kind-0.1.0.tar.gz" } ], "0.2.0": [ { "comment_text": "", "digests": { "md5": "1916442b7a57bdc3b3fa8ec829afcc4b", "sha256": "05e5b9ccce84cf808ab8c8494177e4c6f9186a9155fe34d6b9d095874a5b9ec4" }, "downloads": -1, "filename": "pytest_kind-0.2.0-py3-none-any.whl", "has_sig": false, "md5_digest": "1916442b7a57bdc3b3fa8ec829afcc4b", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.7,<4.0", "size": 3348, "upload_time": "2019-08-31T15:10:38", "url": "https://files.pythonhosted.org/packages/83/c3/d23244528d95d2f5ecf5b02014b4ac2168ccd5a656322cec4ba7499b5420/pytest_kind-0.2.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "95d6002098ddca0f9162827d17ac8edf", "sha256": "b9bd813800506c65639d979b811345d259887da7a2fe6ee8d19413a672e35a35" }, "downloads": -1, "filename": "pytest-kind-0.2.0.tar.gz", "has_sig": false, "md5_digest": "95d6002098ddca0f9162827d17ac8edf", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.7,<4.0", "size": 2672, "upload_time": "2019-08-31T15:10:37", "url": "https://files.pythonhosted.org/packages/f4/40/d55cc17c324925d4cd35777a9cbe194dd9388b66e1f637ab3c4bf79e1b30/pytest-kind-0.2.0.tar.gz" } ], "0.3.0": [ { "comment_text": "", "digests": { "md5": "a0655d594d23aa1464785bf8e71c7255", "sha256": "007a8c550413a3456b4fd45ff57eda816dd3eae81775b37c27e8d78c8e0405d7" }, "downloads": -1, "filename": "pytest_kind-0.3.0-py3-none-any.whl", "has_sig": false, "md5_digest": "a0655d594d23aa1464785bf8e71c7255", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.7,<4.0", "size": 3801, "upload_time": "2019-08-31T15:56:47", "url": "https://files.pythonhosted.org/packages/48/bd/9cc65ae272e23b3e808d060bb47ffb03f61ca96d8fea48508ba75e9d332d/pytest_kind-0.3.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "a6c54458e8918e40fd403f64319d447a", "sha256": "8b5bef82cb09f57417dd5f8439d9bffa00bf5fcd58fa15600f94b64e255411a2" }, "downloads": -1, "filename": "pytest-kind-0.3.0.tar.gz", "has_sig": false, "md5_digest": "a6c54458e8918e40fd403f64319d447a", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.7,<4.0", "size": 3265, "upload_time": "2019-08-31T15:56:46", "url": "https://files.pythonhosted.org/packages/e4/08/69b05b83822d62588a954263f3c89d8a21905eae8eedd73cc254dd0b1950/pytest-kind-0.3.0.tar.gz" } ], "0.4.0": [ { "comment_text": "", "digests": { "md5": "57331a029c37b3f9243ee9b7ce61a404", "sha256": "cbddbe19901651f6cfedf6aca8d102f40b564acd626b00afe1afca449a909d5b" }, "downloads": -1, "filename": "pytest_kind-0.4.0-py3-none-any.whl", "has_sig": false, "md5_digest": "57331a029c37b3f9243ee9b7ce61a404", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.7,<4.0", "size": 4207, "upload_time": "2019-08-31T17:43:22", "url": "https://files.pythonhosted.org/packages/fa/46/256dbd6bc3b9918a869f7b56630ff4e3b8be3d1e99f2137be256f427d8a6/pytest_kind-0.4.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "935107e93a430bb4e7fe38e006527002", "sha256": "ade03fe3bbe1818eb75f0fbc949c4422182224e9ac1c7c31e762120fdb1904d4" }, "downloads": -1, "filename": "pytest-kind-0.4.0.tar.gz", "has_sig": false, "md5_digest": "935107e93a430bb4e7fe38e006527002", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.7,<4.0", "size": 3674, "upload_time": "2019-08-31T17:43:21", "url": "https://files.pythonhosted.org/packages/59/1e/dbeced62c518237942e0d1114b3e8dae96e8fc1999681840e0f4054468c9/pytest-kind-0.4.0.tar.gz" } ], "0.5.0": [ { "comment_text": "", "digests": { "md5": "e7ac1d91141c56dd98e70ac860fae203", "sha256": "3adbc0ca0a51b3886344a675d3b5ec56f1bde30b2c8254bc3cef9add1a86852f" }, "downloads": -1, "filename": "pytest_kind-0.5.0-py3-none-any.whl", "has_sig": false, "md5_digest": "e7ac1d91141c56dd98e70ac860fae203", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.7,<4.0", "size": 4442, "upload_time": "2019-08-31T18:30:32", "url": "https://files.pythonhosted.org/packages/c3/23/1896bdd5504b514fd62dfda230806f8ec871d48fc9fc0c8b4ba268e9f6f3/pytest_kind-0.5.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "d80e71116355f46ba4c8366055e3b4cb", "sha256": "bd27e38b2f9d1568e56791cd07b546ab53c883fc6ad28e4140ac48f176456364" }, "downloads": -1, "filename": "pytest-kind-0.5.0.tar.gz", "has_sig": false, "md5_digest": "d80e71116355f46ba4c8366055e3b4cb", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.7,<4.0", "size": 3938, "upload_time": "2019-08-31T18:30:31", "url": "https://files.pythonhosted.org/packages/74/df/86bf34ce4ece47152db375332d7066f68ed42b5b9516d3b7e9036a740843/pytest-kind-0.5.0.tar.gz" } ], "0.6.0": [ { "comment_text": "", "digests": { "md5": "1c12191f5766dbac4df9e39759f03fd0", "sha256": "98b9d8dcfb818be05078d111923d62be7acedcef8dff142e06aa12324d6f14b2" }, "downloads": -1, "filename": "pytest_kind-0.6.0-py3-none-any.whl", "has_sig": false, "md5_digest": "1c12191f5766dbac4df9e39759f03fd0", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.7,<4.0", "size": 4509, "upload_time": "2019-08-31T19:35:13", "url": "https://files.pythonhosted.org/packages/a1/47/4a3c3aa7ede06cd07fe84735b4e7a1b71aa6b7f937c2b90cb3c6d8d2eb42/pytest_kind-0.6.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "a6c3a27a20f3510301f13c41bc61b9f2", "sha256": "480c3e0be2a0b91a02391ff5c523278e12053d2b6a8c24d713819da8e0542474" }, "downloads": -1, "filename": "pytest-kind-0.6.0.tar.gz", "has_sig": false, "md5_digest": "a6c3a27a20f3510301f13c41bc61b9f2", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.7,<4.0", "size": 3999, "upload_time": "2019-08-31T19:35:12", "url": "https://files.pythonhosted.org/packages/95/24/12c573e83e0936195604a5babc641ee6190803f152dd4209b7911aba4ef1/pytest-kind-0.6.0.tar.gz" } ], "19.9.0": [ { "comment_text": "", "digests": { "md5": "715ffe0b14cbb77f39dadf626b1d1673", "sha256": "40a26d5a7cb32ca189242c5ce60c00959f7e547481645aafe7b080b42e61dea3" }, "downloads": -1, "filename": "pytest_kind-19.9.0-py3-none-any.whl", "has_sig": false, "md5_digest": "715ffe0b14cbb77f39dadf626b1d1673", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.7,<4.0", "size": 17805, "upload_time": "2019-09-01T10:51:21", "url": "https://files.pythonhosted.org/packages/67/f7/96a6987e199a9094c8d37c4283566c2bbf96cc9917ee55af15f59892b2bf/pytest_kind-19.9.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "c629d3506d36647855eedf6880fffa96", "sha256": "25252d46487afff8ba143e97f9eed497ac6f26716bd6a392224dfc3ef31a3956" }, "downloads": -1, "filename": "pytest-kind-19.9.0.tar.gz", "has_sig": false, "md5_digest": "c629d3506d36647855eedf6880fffa96", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.7,<4.0", "size": 17233, "upload_time": "2019-09-01T10:51:20", "url": "https://files.pythonhosted.org/packages/46/72/b90fe11be50dc4093524222fa0866a1817c8445461ba7397f8c680d2366f/pytest-kind-19.9.0.tar.gz" } ], "19.9.1": [ { "comment_text": "", "digests": { "md5": "203fad2b025e040025788bf0c08d46bf", "sha256": "523786ea7c3aa6f92240223cacec89a532405a15dbb7884283baef67b85bcc56" }, "downloads": -1, "filename": "pytest_kind-19.9.1-py3-none-any.whl", "has_sig": false, "md5_digest": "203fad2b025e040025788bf0c08d46bf", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.7,<4.0", "size": 17814, "upload_time": "2019-09-03T16:05:32", "url": "https://files.pythonhosted.org/packages/69/20/58ec107d672e7e1fff355d5993d9682534cf40f6b850b1da0d56138166c0/pytest_kind-19.9.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "43d0ad226676b6d48c7b07d6742a2974", "sha256": "73823232d5f19c57e772a2b172c2490c1d3f1fcdab9964e7f0425805e9f871b1" }, "downloads": -1, "filename": "pytest-kind-19.9.1.tar.gz", "has_sig": false, "md5_digest": "43d0ad226676b6d48c7b07d6742a2974", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.7,<4.0", "size": 17248, "upload_time": "2019-09-03T16:05:30", "url": "https://files.pythonhosted.org/packages/89/21/dba2d39e665741d87deb04b816a079d55c40793e0651f12fcf968f717dc3/pytest-kind-19.9.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "203fad2b025e040025788bf0c08d46bf", "sha256": "523786ea7c3aa6f92240223cacec89a532405a15dbb7884283baef67b85bcc56" }, "downloads": -1, "filename": "pytest_kind-19.9.1-py3-none-any.whl", "has_sig": false, "md5_digest": "203fad2b025e040025788bf0c08d46bf", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.7,<4.0", "size": 17814, "upload_time": "2019-09-03T16:05:32", "url": "https://files.pythonhosted.org/packages/69/20/58ec107d672e7e1fff355d5993d9682534cf40f6b850b1da0d56138166c0/pytest_kind-19.9.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "43d0ad226676b6d48c7b07d6742a2974", "sha256": "73823232d5f19c57e772a2b172c2490c1d3f1fcdab9964e7f0425805e9f871b1" }, "downloads": -1, "filename": "pytest-kind-19.9.1.tar.gz", "has_sig": false, "md5_digest": "43d0ad226676b6d48c7b07d6742a2974", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.7,<4.0", "size": 17248, "upload_time": "2019-09-03T16:05:30", "url": "https://files.pythonhosted.org/packages/89/21/dba2d39e665741d87deb04b816a079d55c40793e0651f12fcf968f717dc3/pytest-kind-19.9.1.tar.gz" } ] }