From 39dd2b6e834a53441ad1207ca67bf748f887b066 Mon Sep 17 00:00:00 2001 From: q0w <43147888+q0w@users.noreply.github.com> Date: Wed, 28 Dec 2022 18:49:04 +0300 Subject: Create temp_dir if not exists (#2781) Closes https://github.com/tox-dev/tox/issues/2770 --- tests/tox_env/test_api.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 tests/tox_env/test_api.py (limited to 'tests') 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() -- cgit v1.2.1