summaryrefslogtreecommitdiff
path: root/tests/test_testing.py
diff options
context:
space:
mode:
authorDiaga <diagaaos@gmail.com>2020-11-23 16:25:12 +0500
committerDavid Lord <davidism@gmail.com>2021-02-15 14:06:02 -0800
commita9711c50be5ee37104068b309431c5ab02968b8f (patch)
tree2db3f457f6f4071779b6080d52afbbfec8d3086e /tests/test_testing.py
parent90a6c78ae574de35d3783e0d575b688a12f09a3d (diff)
downloadclick-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.py15
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)