{ "info": { "author": "Oliver Cope", "author_email": "oliver@redgecko.org", "bugtrack_url": null, "classifiers": [ "License :: OSI Approved :: BSD License", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7", "Topic :: Software Development :: Testing" ], "description": "\nFrozendate: stop time for your tests\n====================================\n\nFrozendate suspends time while your tests run.\n\nFrozendate mocks ``datetime.datetime`` and ``datetime.date`` to provide known\ntimes when testing.\n\nUsage\n-----\n\n::\n\n import frozendate\n\n with frozendate.freeze(1999, 1, 1):\n party_like_its_1999()\n\n # freeze relative freezes time relative to the current date...\n with freeze_relative(days=-1):\n assert all_my_troubles_seemed_so_far_away()\n\n with freeze(1999, 12, 31):\n # ...or relative to the previous freeze\n with freeze_relative(days=1):\n print \"happy new year!\"\n\n\nNormally time doesn't actually stop when you use freeze \u2013 it just starts \nagain from the fixed point you specify, eg::\n\n >>> import frozendate\n >>> import datetime\n >>> with frozendate.freeze(2000, 1, 1):\n ... print datetime.now().replace(microsecond=0)\n ... time.sleep(1)\n ... print datetime.now().replace(microsecond=0)\n ...\n 2000-01-01 00:00:00\n 2000-01-01 00:00:01\n\nBut you can always get the same value back if you pass ``hard=True``::\n\n >>> with frozendate.freeze(2000, 1, 1, hard=True):\n ... print datetime.now().replace(microsecond=0)\n ... time.sleep(1)\n ... print datetime.now().replace(microsecond=0)\n ...\n 2000-01-01 00:00:00\n 2000-01-01 00:00:00\n\n\nInstead of a context manager there are also regular patch and unpatch\nfunctions.\nThese are useful in test case setup/teardown methods::\n\n def setUp(self):\n frozendate.patch(2000, 1, 1)\n\n def tearDown(self):\n frozendate.unpatch()\n\nWhen you call freeze or patch, it freezes time for all modules found in\n``sys.modules``.\nSometimes you want to restrict to a few named modules::\n\n frozendate.freeze(modules=['mypackage.mymodule'])\n\nOr patch everything, but exclude a few modules that need the real datetime\nstill::\n\n frozendate.freeze(dontpatch=['somemodule', 'someotherpackage'])\n\n\n0.1.3 (released 2018-10-10)\n---------------------------\n\n- Fix exception when used with dateutil\n- Add support for Python 3.7\n- Drop support for Python 2.6\n\nVersion 0.1.2\n-------------\n\n- Add support for freezing datetime.utcnow()\n\nVersion 0.1.1\n-------------\n\n- Fix for ImportErrors when used with six\n\nVersion 0.1\n------------\n\n- Initial release\n\n\n", "description_content_type": "", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://bitbucket.org/ollyc/frozendate/", "keywords": "", "license": "BSD", "maintainer": "", "maintainer_email": "", "name": "frozendate", "package_url": "https://pypi.org/project/frozendate/", "platform": "", "project_url": "https://pypi.org/project/frozendate/", "project_urls": { "Homepage": "https://bitbucket.org/ollyc/frozendate/" }, "release_url": "https://pypi.org/project/frozendate/0.1.3/", "requires_dist": [ "mock" ], "requires_python": "", "summary": "Frozen date: freeze datetime.now at a known value for testing", "version": "0.1.3" }, "last_serial": 4360386, "releases": { "0": [], "0.1": [ { "comment_text": "", "digests": { "md5": "fc790f0227375c407aff12941b6a34f0", "sha256": "ccf6d545756e3fb9b089027648236d997f153ebbb1d88682b2a497fcd13534c7" }, "downloads": -1, "filename": "frozendate-0.1.tar.gz", "has_sig": false, "md5_digest": "fc790f0227375c407aff12941b6a34f0", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4943, "upload_time": "2013-09-17T14:40:53", "url": "https://files.pythonhosted.org/packages/69/74/99ba92acb094bae62cacc4ae98c7e99d42c267902c2a0813561b10f5b2ab/frozendate-0.1.tar.gz" } ], "0.1.1": [ { "comment_text": "", "digests": { "md5": "3c08d7189d8def0da64546feca0f0cf3", "sha256": "5d011e057a5d2c66896dfe99fe27832372c76d76f3074c214345323777b9ca9e" }, "downloads": -1, "filename": "frozendate-0.1.1.tar.gz", "has_sig": false, "md5_digest": "3c08d7189d8def0da64546feca0f0cf3", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4982, "upload_time": "2014-01-10T14:49:28", "url": "https://files.pythonhosted.org/packages/e8/cc/9ec1dbe1560d4e2aa9cd0a698247341d8fb209e734827498ea2972a8ce9e/frozendate-0.1.1.tar.gz" } ], "0.1.2": [ { "comment_text": "", "digests": { "md5": "5c5f80adbd46a0a062a8ad365b9f866a", "sha256": "e21a54108babbaabe45d9e342428342334775ee8a353e01dad895df3d3e4a01d" }, "downloads": -1, "filename": "frozendate-0.1.2.tar.gz", "has_sig": false, "md5_digest": "5c5f80adbd46a0a062a8ad365b9f866a", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5118, "upload_time": "2015-02-13T12:37:17", "url": "https://files.pythonhosted.org/packages/59/af/1a7236ccf64e6c8b00ae92e8b3715024d5bfad9ff916f58fec02ad745804/frozendate-0.1.2.tar.gz" } ], "0.1.3": [ { "comment_text": "", "digests": { "md5": "b8386565e6c44b157ba03de0530a05c3", "sha256": "5f23cc4e90781e8d4f639a9468e1403fb70121573dd4ff3cbadab0cd701a4b80" }, "downloads": -1, "filename": "frozendate-0.1.3-py3-none-any.whl", "has_sig": false, "md5_digest": "b8386565e6c44b157ba03de0530a05c3", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 6038, "upload_time": "2018-10-10T14:53:16", "url": "https://files.pythonhosted.org/packages/9c/05/614de39ab3be49aa502ff8ce4911bc64ec4b1451342e31d33abf69cf127d/frozendate-0.1.3-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "e87d02937e92692611e53b220fa2e8eb", "sha256": "153377d5aa475e022d4356b4835d4e9acf5309a43739bd7567f4d1cb81edd354" }, "downloads": -1, "filename": "frozendate-0.1.3.tar.gz", "has_sig": false, "md5_digest": "e87d02937e92692611e53b220fa2e8eb", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5190, "upload_time": "2018-10-10T14:53:17", "url": "https://files.pythonhosted.org/packages/ff/4e/788835feae7d870a45e55d72d8a313f8ccc531692b928dd793ad96882948/frozendate-0.1.3.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "b8386565e6c44b157ba03de0530a05c3", "sha256": "5f23cc4e90781e8d4f639a9468e1403fb70121573dd4ff3cbadab0cd701a4b80" }, "downloads": -1, "filename": "frozendate-0.1.3-py3-none-any.whl", "has_sig": false, "md5_digest": "b8386565e6c44b157ba03de0530a05c3", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 6038, "upload_time": "2018-10-10T14:53:16", "url": "https://files.pythonhosted.org/packages/9c/05/614de39ab3be49aa502ff8ce4911bc64ec4b1451342e31d33abf69cf127d/frozendate-0.1.3-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "e87d02937e92692611e53b220fa2e8eb", "sha256": "153377d5aa475e022d4356b4835d4e9acf5309a43739bd7567f4d1cb81edd354" }, "downloads": -1, "filename": "frozendate-0.1.3.tar.gz", "has_sig": false, "md5_digest": "e87d02937e92692611e53b220fa2e8eb", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5190, "upload_time": "2018-10-10T14:53:17", "url": "https://files.pythonhosted.org/packages/ff/4e/788835feae7d870a45e55d72d8a313f8ccc531692b928dd793ad96882948/frozendate-0.1.3.tar.gz" } ] }