Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create temp_dir if not exists (#2781)
Closes #2770
- Loading branch information
Showing
4 changed files
with
24 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Create temp_dir if not exists - by :user:`q0w`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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() |