diff options
author | Diaga <diagaaos@gmail.com> | 2020-11-23 16:25:12 +0500 |
---|---|---|
committer | David Lord <davidism@gmail.com> | 2021-02-15 14:06:02 -0800 |
commit | a9711c50be5ee37104068b309431c5ab02968b8f (patch) | |
tree | 2db3f457f6f4071779b6080d52afbbfec8d3086e /tests/test_testing.py | |
parent | 90a6c78ae574de35d3783e0d575b688a12f09a3d (diff) | |
download | click-a9711c50be5ee37104068b309431c5ab02968b8f.tar.gz |
custom temp directory with CLIRunner.isolated_filesystem
Co-authored-by: David Lord <davidism@gmail.com>
Diffstat (limited to 'tests/test_testing.py')
-rw-r--r-- | tests/test_testing.py | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/test_testing.py b/tests/test_testing.py index 758e173..8b40596 100644 --- a/tests/test_testing.py +++ b/tests/test_testing.py @@ -319,3 +319,18 @@ def test_file_stdin_attrs(runner): result = runner.invoke(cli, ["-"]) assert result.output == "<stdin>\nr" + + +def test_isolated_runner(runner): + with runner.isolated_filesystem() as d: + assert os.path.exists(d) + + assert not os.path.exists(d) + + +def test_isolated_runner_custom_tempdir(runner, tmp_path): + with runner.isolated_filesystem(temp_dir=tmp_path) as d: + assert os.path.exists(d) + + assert os.path.exists(d) + os.rmdir(d) |