aboutsummaryrefslogtreecommitdiff
path: root/tests/context.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/context.py')
-rw-r--r--tests/context.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/tests/context.py b/tests/context.py
index 5878771..8900a30 100644
--- a/tests/context.py
+++ b/tests/context.py
@@ -29,19 +29,22 @@ projectdir = os.path.dirname(os.path.dirname(os.path.abspath(whatmaps.__file__))
_chdir_backup = None
_tmpdirs = []
+
def chdir(dir):
global _chdir_backup
if not _chdir_backup:
_chdir_backup = os.path.abspath(os.curdir)
os.chdir(str(dir))
+
def new_tmpdir(name):
global _tmpdirs
- prefix='whatmaps_%s_' % name
+ prefix = 'whatmaps_%s_' % name
tmpdir = TmpDir(prefix)
_tmpdirs.append(tmpdir)
return tmpdir
+
def teardown():
if _chdir_backup:
os.chdir(_chdir_backup)
@@ -49,6 +52,7 @@ def teardown():
tmpdir.rmdir()
del _tmpdirs[:]
+
class TmpDir(object):
def __init__(self, suffix='', prefix='tmp'):