diff options
author | Guido Günther <agx@sigxcpu.org> | 2016-09-23 13:15:27 +0200 |
---|---|---|
committer | Guido Günther <agx@sigxcpu.org> | 2016-09-23 13:15:27 +0200 |
commit | 9ffc5cbb599ea3859804979f1570d17a5c0373a2 (patch) | |
tree | 8118b317885ac543c1399497bdf9643c8b887340 /tests/context.py | |
parent | ead569ed946d5e7414ec4c328d4d8b2a6bb3009c (diff) | |
parent | 48651cda01095017ddc5e67a2491c02a44027ab5 (diff) |
Merge tag 'v0.0.12' into debian/master
whatmaps v0.0.12
Diffstat (limited to 'tests/context.py')
-rw-r--r-- | tests/context.py | 6 |
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'): |