summaryrefslogtreecommitdiff
path: root/tests/tox_env/test_api.py
blob: 95efdc9e1a7cefb824742656da74a1ce400c846e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
from __future__ import annotations

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()