{ "info": { "author": "real", "author_email": "realcr@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 3 - Alpha", "Intended Audience :: Developers", "License :: OSI Approved :: Apache Software License", "Programming Language :: Python :: 3.4", "Topic :: Software Development :: Testing" ], "description": "Asyncio Time Travel Loop\n========================\n\nIntro\n-----\n\nAsyncio Time Travel Loop allows you to test asyncio code that waits or sleeps,\nwithout actually waiting or sleeping.\n\nAt the same time, you don't have to bother thinking about how the time\nadvances. Your code should work exactly the same with TimeTravelLoop as it works\nwith a normal asyncio events loop.\n\nExample: Assume that you have a code that waits 1000 seconds, and you want to\ntests that code. Instead of actually waiting 1000 seconds, you could use\nTimeTravelLoop:\n\n```python\nimport asyncio\nfrom asyncio_time_travel import TimeTravelLoop\n\nSLEEP_TIME = 1000\n\ntloop = TimeTravelLoop()\n\n@asyncio.coroutine\ndef inner_cor():\n # Sleep for a long time:\n yield from asyncio.sleep(SLEEP_TIME,loop=tloop)\n\ntloop.run_until_complete(inner_cor())\n```\n\nThis code completes immediately.\n\nSee some of the [tests](https://github.com/realcr/asyncio_time_travel/blob/master/asyncio_time_travel/tests/test_time_travel_loop.py) for more advanced examples of what TimeTravelLoop can do.\n\nInstallation\n------------\nRun:\n```bash\npip install --pre asyncio-time-travel\n```\nYou can also find the package at https://pypi.python.org/pypi/asyncio-time-travel .\n\nTests\n-----\n\nRun (Inside asyncio_time_travel dir):\n```bash\npy.test\n```\n\nIf you haven't yet heard of [py.test](http://pytest.org), it's your lucky day :)\n\n\nHow does this work?\n-------------------\n\nTimeTravelLoop source is based on the source code of\nasyncio.test_utils.TestLoop.\n\nFor each _run_once iteration of the loop, the following is done:\n- Loop events are executed.\n- Time is advanced to the closest scheduled event.\n\nUsing this method your code never waits, and at the same time the events\nexecute in the correct order.\n\n\nLimitations\n-----------\n\nTimeTravelLoop is meant to be used with your tests, not for production code. In\nparticular, if your loop interacts with external events, bending time is not a\ngood idea (Time will advance differently outside of your loop).\n\n\nFurther work\n------------\n\n- The code might have bugs. If you find any issues, don't hesitate to fork or\nopen an issue. \n\n- It might be possible to integrate this code into asyncio.test_utils in some\n way.", "description_content_type": null, "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/realcr/asyncio_time_travel", "keywords": "asyncio testing time travel sleep", "license": "Apache 2.0", "maintainer": "", "maintainer_email": "", "name": "asyncio-time-travel", "package_url": "https://pypi.org/project/asyncio-time-travel/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/asyncio-time-travel/", "project_urls": { "Homepage": "https://github.com/realcr/asyncio_time_travel" }, "release_url": "https://pypi.org/project/asyncio-time-travel/0.1.4/", "requires_dist": [ "asyncio; python_version==\"3.3\"" ], "requires_python": "", "summary": "Asyncio Time Travel Loop", "version": "0.1.4" }, "last_serial": 1875429, "releases": { "0.1.0a0": [], "0.1.1a0": [ { "comment_text": "", "digests": { "md5": "42203671f7a374eeed5b308f97071d60", "sha256": "499f607c2e9ce30a30e88c685a4d94d75f53f641dabae6dfb476e4fecafc7f3b" }, "downloads": -1, "filename": "asyncio_time_travel-0.1.1a0-py3-none-any.whl", "has_sig": false, "md5_digest": "42203671f7a374eeed5b308f97071d60", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 8208, "upload_time": "2015-04-07T16:42:55", "url": "https://files.pythonhosted.org/packages/aa/7d/64856f397f92159d10bfefde259bf5773c953595088a110ab1cb843d6e0b/asyncio_time_travel-0.1.1a0-py3-none-any.whl" } ], "0.1.2": [ { "comment_text": "", "digests": { "md5": "688b170a74335a77959b43b501600c75", "sha256": "193adb27e98a8779dc815e137c22c3487956a34fe4bdfb80c204acba08e2a026" }, "downloads": -1, "filename": "asyncio_time_travel-0.1.2-py3-none-any.whl", "has_sig": false, "md5_digest": "688b170a74335a77959b43b501600c75", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 9275, "upload_time": "2015-12-23T13:07:00", "url": "https://files.pythonhosted.org/packages/70/0c/dadfb65c7bcaac99bc713c171ec15cb2046bbad5fbc83a0b70de54047689/asyncio_time_travel-0.1.2-py3-none-any.whl" } ], "0.1.3": [ { "comment_text": "", "digests": { "md5": "805176d54efc5dbf8a4ede4bad55fe4e", "sha256": "b004f3d3820de31a06a416c39bf03d32f4d9af22948889798c05763c6019888b" }, "downloads": -1, "filename": "asyncio_time_travel-0.1.3-py3-none-any.whl", "has_sig": false, "md5_digest": "805176d54efc5dbf8a4ede4bad55fe4e", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 9275, "upload_time": "2015-12-23T13:34:00", "url": "https://files.pythonhosted.org/packages/3f/b1/18fc8b66340558545fa531b9b0fee96196dbb225ca51d9f4a18656c8879f/asyncio_time_travel-0.1.3-py3-none-any.whl" } ], "0.1.4": [ { "comment_text": "", "digests": { "md5": "741417e6a40661b95d325e815c74d3ce", "sha256": "7af7bf71d9b0200a2f639939d5c248088b7ac002d3f2287c179a8b689166a1ad" }, "downloads": -1, "filename": "asyncio_time_travel-0.1.4-py3-none-any.whl", "has_sig": false, "md5_digest": "741417e6a40661b95d325e815c74d3ce", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 6371, "upload_time": "2015-12-23T14:46:59", "url": "https://files.pythonhosted.org/packages/cb/ba/224eb6847f93093932a1c0080047567f6d907a9a252012fc9098e2bb888b/asyncio_time_travel-0.1.4-py3-none-any.whl" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "741417e6a40661b95d325e815c74d3ce", "sha256": "7af7bf71d9b0200a2f639939d5c248088b7ac002d3f2287c179a8b689166a1ad" }, "downloads": -1, "filename": "asyncio_time_travel-0.1.4-py3-none-any.whl", "has_sig": false, "md5_digest": "741417e6a40661b95d325e815c74d3ce", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 6371, "upload_time": "2015-12-23T14:46:59", "url": "https://files.pythonhosted.org/packages/cb/ba/224eb6847f93093932a1c0080047567f6d907a9a252012fc9098e2bb888b/asyncio_time_travel-0.1.4-py3-none-any.whl" } ] }