diff options
| author | Eugene Triguba <eugenetriguba@gmail.com> | 2023-04-30 12:45:18 -0400 |
|---|---|---|
| committer | Eugene Triguba <eugenetriguba@gmail.com> | 2023-04-30 12:45:18 -0400 |
| commit | 409b1b2bf3043b8aca226db39505df3ba9aab937 (patch) | |
| tree | f83a437faf4f16a92585685153d41aa5d356c98b /tests/utils.py | |
| parent | Use variable in `test` task (diff) | |
| download | poetry-plugin-taskipy2-409b1b2bf3043b8aca226db39505df3ba9aab937.zip | |
Ensure test cases are testing the command output
Diffstat (limited to 'tests/utils.py')
| -rw-r--r-- | tests/utils.py | 15 |
1 files changed, 15 insertions, 0 deletions
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) |