You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
ngcpcfg/t/fixtures/fs.py

16 lines
265 B

#!/usr/bin/env python3
import pytest
import os.path
import contextlib
@contextlib.contextmanager
def keep_directory():
"""Restore the current working directory when finished."""
cwd = os.getcwd()
try:
yield
finally:
os.chdir(cwd)