import os
import logging
import shutil
import tempfile
import contextlib
_LOGGER = logging.getLogger(__name__)
@contextlib.contextmanager
def temp_path():
path = tempfile.mkdtemp()
original_wd = os.getcwd()
os.chdir(path)
try:
yield path
finally:
os.chdir(original_wd)
if os.path.exists(path) is True:
shutil.rmtree(path)
| Name | Type | Size | Permission | Actions |
|---|---|---|---|---|
| __pycache__ | Folder | 0755 |
|
|
| resources | Folder | 0755 |
|
|
| __init__.py | File | 0 B | 0644 |
|
| adapters.py | File | 12.99 KB | 0644 |
|
| calls.py | File | 1.77 KB | 0644 |
|
| constants.py | File | 2.2 KB | 0644 |
|
| library.py | File | 177 B | 0644 |
|
| test_support.py | File | 383 B | 0644 |
|