Skip to content
Snippets Groups Projects
Commit 126f5f21 authored by Paul McCarthy's avatar Paul McCarthy :mountain_bicyclist:
Browse files

tempdir function allows a destination

parent 0e5da21a
No related branches found
No related tags found
No related merge requests found
......@@ -21,12 +21,16 @@ import contextlib
@contextlib.contextmanager
def tempdir():
def tempdir(root=None):
"""Returns a context manager which creates and returns a temporary
directory, and then deletes it on exit.
:arg root: If provided, specifies a directroy in which to create the
new temporary directory. Otherwise the system default is used
(see the ``tempfile.mkdtemp`` documentation).
"""
testdir = tempfile.mkdtemp()
testdir = tempfile.mkdtemp(dir=root)
prevdir = os.getcwd()
try:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment