1
0
Fork 0
cli-helpers/tests/utils.py
Daniel Baumann 95bca6b33d
Merging upstream version 2.2.0.
Signed-off-by: Daniel Baumann <daniel@debian.org>
2025-02-07 00:48:48 +01:00

18 lines
446 B
Python

# -*- 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