diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-04 17:37:29 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-04 17:37:29 +0000 |
commit | de734e6e5777abb6f8f16f94166ecd3dbe179421 (patch) | |
tree | fff61580a08934083aab3043d228c2f484f6f844 /tests/utils.py | |
parent | Initial commit. (diff) | |
download | cli-helpers-de734e6e5777abb6f8f16f94166ecd3dbe179421.tar.xz cli-helpers-de734e6e5777abb6f8f16f94166ecd3dbe179421.zip |
Adding upstream version 2.3.0.upstream/2.3.0upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/utils.py')
-rw-r--r-- | tests/utils.py | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/utils.py b/tests/utils.py new file mode 100644 index 0000000..0088eec --- /dev/null +++ b/tests/utils.py @@ -0,0 +1,18 @@ +# -*- coding: utf-8 -*- +"""Utility functions for CLI Helpers' tests.""" + +from __future__ import unicode_literals +from functools import wraps + +from .compat import TemporaryDirectory + + +def with_temp_dir(f): + """A wrapper that creates and deletes a temporary directory.""" + + @wraps(f) + def wrapped(*args, **kwargs): + with TemporaryDirectory() as temp_dir: + return f(*args, temp_dir=temp_dir, **kwargs) + + return wrapped |