{ "info": { "author": "Kriszti\u00e1n Fekete", "author_email": "fkr972+temp_dir@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Topic :: Software Development :: Libraries", "Topic :: Software Development :: Testing" ], "description": "========\ntemp_dir\n========\n\nChange into newly created temporary directory for executing a block of code.\n\nUpon leaving the code block the temporary directory and all its contents are\nremoved and the original working directory is restored.\n\nIntended as a tool to ease \"integration\" testing.\n\nThe package contains only two functions: `in_temp_dir` to be used with the `with` statement\nand `within_temp_dir` to decorate a function.\n\n\n--------\nExamples\n--------\n\nFunction decorator::\n\n @within_temp_dir\n def f():\n return os.getcwd()\n\n\n class TestScript(unittest.TestCase):\n\n @within_temp_dir\n def test_output_file_created(self):\n self.create_input_file()\n call_script('input')\n self.assertTrue(os.path.exists('output'))\n\n\nContext manager::\n\n with in_temp_dir():\n with open('tempfile', 'w') as f:\n f.write(...)\n process_file('tempfile')\n\n\n-------------------------------\nSimilar functionality elsewhere\n-------------------------------\n\nSimilar functionality can be found at\n\n- test.test_support.temp_cwd\n (http://docs.python.org/3/library/test.html#test.support.temp_cwd)\n in the Python distribution\n - temp_cwd is quite close to this module,\n unfortunately it is not in the standard library,\n but packaged together with the regression tests.\n temp_cwd's source shows some special cases\n and runs the code in a directory that can be guessed\n\n- tempdir (https://bitbucket.org/another_thomas/tempdir)\n\n- tempdirs (https://github.com/thelinuxkid/tempdirs)\n - for creating any number of temporary directories\n\n- path.py (https://github.com/jaraco/path.py/blob/master/path.py)\n - tempdir at the end of the file", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/krisztianfekete/temp_dir", "keywords": null, "license": "MIT License", "maintainer": null, "maintainer_email": null, "name": "temp_dir", "package_url": "https://pypi.org/project/temp_dir/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/temp_dir/", "project_urls": { "Download": "UNKNOWN", "Homepage": "https://github.com/krisztianfekete/temp_dir" }, "release_url": "https://pypi.org/project/temp_dir/0.1.1/", "requires_dist": null, "requires_python": null, "summary": "Execute block of code within a temporary directory", "version": "0.1.1" }, "last_serial": 718277, "releases": { "0.1.1": [ { "comment_text": "", "digests": { "md5": "ea8e9ac38b3963311b2681c735ff87b2", "sha256": "d11a43aef656bb00cdcd89e159803f88c5cc8a3aa4ca40c45bb7e5fd02c8bb5f" }, "downloads": -1, "filename": "temp_dir-0.1.1.tar.gz", "has_sig": false, "md5_digest": "ea8e9ac38b3963311b2681c735ff87b2", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 2704, "upload_time": "2013-04-13T22:22:03", "url": "https://files.pythonhosted.org/packages/ae/11/1decdc521eb191f4ecef1d71c88366fae5fecf0506fd270ae099581ae299/temp_dir-0.1.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "ea8e9ac38b3963311b2681c735ff87b2", "sha256": "d11a43aef656bb00cdcd89e159803f88c5cc8a3aa4ca40c45bb7e5fd02c8bb5f" }, "downloads": -1, "filename": "temp_dir-0.1.1.tar.gz", "has_sig": false, "md5_digest": "ea8e9ac38b3963311b2681c735ff87b2", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 2704, "upload_time": "2013-04-13T22:22:03", "url": "https://files.pythonhosted.org/packages/ae/11/1decdc521eb191f4ecef1d71c88366fae5fecf0506fd270ae099581ae299/temp_dir-0.1.1.tar.gz" } ] }