{ "info": { "author": "Virgil Dupras", "author_email": "hsoft@hardcoded.net", "bugtrack_url": null, "classifiers": [ "Development Status :: 5 - Production/Stable", "Intended Audience :: Developers", "License :: OSI Approved :: BSD License", "Programming Language :: Python :: 3" ], "description": "===========================================\npytest-monkeyplus - monkeypatch with extras\n===========================================\n\nThe ``monkeyplus`` plugin is a funcarg that subclasses ``monkeypatch`` and adds \na few extra features to it.\n\nExtra features\n--------------\n\n``monkeyplus`` has three extra methods: ``patch_osstat``, ``patch_today`` and\n``patch_time_ticking``.\n\n``patch_osstat(path, **osstat_attrs)``\n\nPatching ``os.stat`` is tricky because you usually want to patch only one file,\nnot the whole filesystem. Moreover, to patch it properly, you have to return a\nfull ``stat_result`` structure. ``patch_osstat`` takes care of this stuff.\nJust call it with a path to patch and keyword arguments for the stat attributes\nyou want, for example::\n\n monkeyplus.patch_osstat('foo/bar', st_mtime=42)\n\nArguments that are not specified will be assigned a default value.\n\n``patch_today(year, month, day)``\n\nPatching dates can be tricky because there's a couple of time relates modules,\nnamely ``datetime`` and ``time``. If you want your patch to affect the whole app\nuniformly, you have to patch the ``time`` module, not the ``datetime`` module.\nThe arithmetics to transform a year/month/day value in a suitable ``time.time``\nvalue are non-trivial, so it can get boring to repeat. Call ``patch_today`` with\nthe date you'd like the app to be patched to, example::\n\n monkeyplus.patch_today(2011, 2, 16)\n\n``patch_time_ticking(force_int_diff=False)``\n\nThis monkeypatch ensures that all ``time.time()`` calls yield different results (and increasing). On\nmany platforms, this is already guaranteed, but not on all of them.\n\nIf ``force_int_diff`` is True, the patch ensures that all ``int(time.time())`` calls yield different\nresults. Note that it also means that the patches function will return ``int`` values.\n\nReplacing monkeypatch\n---------------------\n\n``monkeyplus`` is a subclass of ``monkeypatch``, so it can be used everywhere\n``monkeypatch`` is used. Instead of having to use a different funcarg, you can\nreplace ``monkeypatch`` by putting this in your ``conftest.py`` file::\n\n def pytest_funcarg__monkeypatch(request):\n monkeyplus = request.getfuncargvalue('monkeyplus')\n return monkeyplus\n\nContributions welcome\n---------------------\n\nFor now, ``monkeyplus`` is a plugin that reflect my own needs, but if you'd like\nto contribute new features to it, they're welcome. The source is hosted at http://bitbucket.org/hsoft/pytest-monkeyplus\n\n\nChanges\n=======\n\nVersion 1.1.0 -- 2012-09-18\n---------------------------\n\n* Added patch_time_ticking() function.\n\nVersion 1.0.0 -- 2011-02-16\n---------------------------\n\n* Initial Release", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "http://bitbucket.org/hsoft/pytest-monkeyplus/", "keywords": null, "license": "UNKNOWN", "maintainer": null, "maintainer_email": null, "name": "pytest-monkeyplus", "package_url": "https://pypi.org/project/pytest-monkeyplus/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/pytest-monkeyplus/", "project_urls": { "Download": "UNKNOWN", "Homepage": "http://bitbucket.org/hsoft/pytest-monkeyplus/" }, "release_url": "https://pypi.org/project/pytest-monkeyplus/1.1.0/", "requires_dist": null, "requires_python": null, "summary": "pytest's monkeypatch subclass with extra functionalities", "version": "1.1.0" }, "last_serial": 663182, "releases": { "1.0.0": [ { "comment_text": "", "digests": { "md5": "7abb27b8cc7741d3c83f79aa6cb7b58b", "sha256": "1460b94e9d0b891be38701c121028d0304648af8007d21122e9d180f6a3c203e" }, "downloads": -1, "filename": "pytest-monkeyplus-1.0.0.tar.gz", "has_sig": false, "md5_digest": "7abb27b8cc7741d3c83f79aa6cb7b58b", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 2977, "upload_time": "2011-02-16T10:30:01", "url": "https://files.pythonhosted.org/packages/3f/cb/8fff3f0326c5ad67eeb67e3509a0d875f4ab1c78ea7b135b0d0df02b9f89/pytest-monkeyplus-1.0.0.tar.gz" } ], "1.1.0": [ { "comment_text": "", "digests": { "md5": "362ecf778f561e0c357e6ac8cda0f666", "sha256": "a4b29b028e320ada728290761a7f35f5ec495d0676ddfc2cd01115a4c9ee350c" }, "downloads": -1, "filename": "pytest-monkeyplus-1.1.0.tar.gz", "has_sig": false, "md5_digest": "362ecf778f561e0c357e6ac8cda0f666", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3605, "upload_time": "2012-09-18T14:48:10", "url": "https://files.pythonhosted.org/packages/07/fa/ef0f6baa09b64280a96c27b6f07662a9fac485b742646a5265e1b8c55e75/pytest-monkeyplus-1.1.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "362ecf778f561e0c357e6ac8cda0f666", "sha256": "a4b29b028e320ada728290761a7f35f5ec495d0676ddfc2cd01115a4c9ee350c" }, "downloads": -1, "filename": "pytest-monkeyplus-1.1.0.tar.gz", "has_sig": false, "md5_digest": "362ecf778f561e0c357e6ac8cda0f666", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3605, "upload_time": "2012-09-18T14:48:10", "url": "https://files.pythonhosted.org/packages/07/fa/ef0f6baa09b64280a96c27b6f07662a9fac485b742646a5265e1b8c55e75/pytest-monkeyplus-1.1.0.tar.gz" } ] }