From 57bc0d56d7e741e1e99d96f14e7ab93232440a16 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sat, 30 Jan 2021 09:13:47 +0100 Subject: Adding upstream version 2.1.0. Signed-off-by: Daniel Baumann --- tests/utils.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 tests/utils.py (limited to 'tests/utils.py') diff --git a/tests/utils.py b/tests/utils.py new file mode 100644 index 0000000..df62e01 --- /dev/null +++ b/tests/utils.py @@ -0,0 +1,16 @@ +# -*- 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 -- cgit v1.2.3