From 409b1b2bf3043b8aca226db39505df3ba9aab937 Mon Sep 17 00:00:00 2001 From: Eugene Triguba Date: Sun, 30 Apr 2023 12:45:18 -0400 Subject: Ensure test cases are testing the command output --- tests/utils.py | 15 +++++++++++++++ 1 file changed, 15 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..202cea5 --- /dev/null +++ b/tests/utils.py @@ -0,0 +1,15 @@ +import contextlib +import os +import io +import pathlib +from typing import Iterator + + +@contextlib.contextmanager +def as_cwd(path: pathlib.Path) -> Iterator[pathlib.Path]: + old_cwd = os.getcwd() + os.chdir(path) + try: + yield path + finally: + os.chdir(old_cwd) -- cgit v1.2.3