{ "info": { "author": "", "author_email": "", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Framework :: Pytest", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7", "Topic :: Software Development :: Testing" ], "description": "[![CircleCI](https://circleci.com/gh/AdamGleave/pytest-shard.svg?style=svg)](https://circleci.com/gh/AdamGleave/pytest-shard)\n[![PyPI version](https://badge.fury.io/py/pytest-shard.svg)](https://badge.fury.io/py/pytest-shard)\n\n# pytest-shard\n\nShards tests based on a hash of their test name enabling easy parallelism across machines, suitable for a wide variety of continuous integration services. Tests are split at the finest level of granularity, individual test cases, enabling parallelism even if all of your tests are in a single file (or even single parameterized test method).\n\n## Features\n\n`pytest-shard` aims for simplicity. When installed, simply run:\n\n```\n$ pytest --shard-id=I --num-shards=N\n```\n\nwhere `I` is the index of this shard and `N` the total number of shards. For example, to split tests across two machines:\n\n```\n# On machine 1:\n$ pytest --shard-id=0 --num-shards=2\n# On machine 2:\n$ pytest --shard-id=1 --num-shards=2\n```\n\nThe intended use case is for continuous integration services that allow you to run jobs in parallel. For CircleCI, enable [parallelism](https://circleci.com/docs/2.0/parallelism-faster-jobs/) and then use:\n```\npytest --shard-id=${CIRCLE_NODE_INDEX} --num-shards=${CIRCLE_NODE_TOTAL}\n```\n\nOn Travis, you must define the environment variables explicitly, but can use a [similar approach](https://docs.travis-ci.com/user/speeding-up-the-build/).\n\n## Alternatives\n\n[pytest-xdist](https://github.com/pytest-dev/pytest-xdist) allows you to parallelize tests across cores on a single machine, and can also schedule tests on a remote machine. I use `pytest-shard` to split tests across CI workers, and `pytest-xdist` to parallelize across CPU cores within each worker.\n\n`pytest-shard` does not take into account the run time of tests, which can lead to suboptimal allocations. [pytest-circleci-parallelized](https://github.com/ryanwilsonperkin/pytest-circleci-parallelized) uses test run time, but can only split at the granularity of classes, and is specific to CircleCI.\n\nPlease open a PR if there are other promising alternatives that I have overlooked.\n\n## Installation\n\nYou can install `pytest-shard` via `pip`:\n\n```\n$ pip install pytest-shard\n```\n\n## Contributions\n\nContributions are welcome. Test may be run using `tox`.\n\n## License\n\nThis software is MIT licensed.", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/AdamGleave/pytest-shard", "keywords": "", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "pytest-shard", "package_url": "https://pypi.org/project/pytest-shard/", "platform": "", "project_url": "https://pypi.org/project/pytest-shard/", "project_urls": { "Homepage": "https://github.com/AdamGleave/pytest-shard" }, "release_url": "https://pypi.org/project/pytest-shard/0.1.1/", "requires_dist": null, "requires_python": ">=3.6", "summary": "", "version": "0.1.1" }, "last_serial": 5997950, "releases": { "0.1": [ { "comment_text": "", "digests": { "md5": "a3ab69f46c7907c3bcec9fbce2cbca4f", "sha256": "7e31947efcfe6d120b136e2f2b31922dee07a3835055530f0ea59499fe0c466b" }, "downloads": -1, "filename": "pytest-shard-0.1.tar.gz", "has_sig": false, "md5_digest": "a3ab69f46c7907c3bcec9fbce2cbca4f", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.6", "size": 3399, "upload_time": "2019-10-18T22:47:17", "url": "https://files.pythonhosted.org/packages/ca/71/755eef39d6d306f1426ebfc6aef3bf20da5158738a4eddb230ceef2f2972/pytest-shard-0.1.tar.gz" } ], "0.1.1": [ { "comment_text": "", "digests": { "md5": "2afd9e5c6f174bba63c66e9bf7c7e0d2", "sha256": "60d94e7027d8e748119241a7b89a6840ea2698368270221566711dec9674bca5" }, "downloads": -1, "filename": "pytest-shard-0.1.1.tar.gz", "has_sig": false, "md5_digest": "2afd9e5c6f174bba63c66e9bf7c7e0d2", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.6", "size": 3497, "upload_time": "2019-10-18T22:56:20", "url": "https://files.pythonhosted.org/packages/38/5d/2388180ba0a6378ac14b09b3e117f9cf6846a55bfb3131d8e6752fd1996b/pytest-shard-0.1.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "2afd9e5c6f174bba63c66e9bf7c7e0d2", "sha256": "60d94e7027d8e748119241a7b89a6840ea2698368270221566711dec9674bca5" }, "downloads": -1, "filename": "pytest-shard-0.1.1.tar.gz", "has_sig": false, "md5_digest": "2afd9e5c6f174bba63c66e9bf7c7e0d2", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.6", "size": 3497, "upload_time": "2019-10-18T22:56:20", "url": "https://files.pythonhosted.org/packages/38/5d/2388180ba0a6378ac14b09b3e117f9cf6846a55bfb3131d8e6752fd1996b/pytest-shard-0.1.1.tar.gz" } ] }