summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorq0w <43147888+q0w@users.noreply.github.com>2022-12-28 18:49:04 +0300
committerGitHub <noreply@github.com>2022-12-28 07:49:04 -0800
commit39dd2b6e834a53441ad1207ca67bf748f887b066 (patch)
treed24159aad3b09f885954950f525e9b96f8b32cbc /tests
parentc850edffe0a37118f39019a06d7702963eaf3d6d (diff)
downloadtox-git-39dd2b6e834a53441ad1207ca67bf748f887b066.tar.gz
Create temp_dir if not exists (#2781)
Closes https://github.com/tox-dev/tox/issues/2770
Diffstat (limited to 'tests')
-rw-r--r--tests/tox_env/test_api.py18
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/tox_env/test_api.py b/tests/tox_env/test_api.py
new file mode 100644
index 00000000..310e7fb5
--- /dev/null
+++ b/tests/tox_env/test_api.py
@@ -0,0 +1,18 @@
+from pathlib import Path
+
+from tox.pytest import ToxProjectCreator
+
+
+def test_ensure_temp_dir_exists(tox_project: ToxProjectCreator) -> None:
+ ini = "[testenv]\ncommands=python -c 'import os; os.path.exists(r\"{temp_dir}\")'"
+ project = tox_project({"tox.ini": ini})
+ result = project.run()
+ result.assert_success()
+
+
+def test_dont_cleanup_temp_dir(tox_project: ToxProjectCreator, tmp_path: Path) -> None:
+ (tmp_path / "foo" / "bar").mkdir(parents=True)
+ project = tox_project({"tox.ini": "[tox]\ntemp_dir=foo"})
+ result = project.run()
+ result.assert_success()
+ assert (tmp_path / "foo" / "bar").exists()