Debian Codegraph @

testing/mozbase/mozproxy/tests/support.py

raw
1 import contextlib
2 import shutil
3 import tempfile
4
5
6 # This helper can be replaced by pytest tmpdir fixture
7 # once Bug 1536029 lands (@mock.patch disturbs pytest fixtures)
8 @contextlib.contextmanager
9 def tempdir():
10 dest_dir = tempfile.mkdtemp()
11 try:
12 yield dest_dir
13 finally:
14 shutil.rmtree(dest_dir, ignore_errors=True)