Skip to content

Commit 6fd694c

Browse files
committed
(WIP): add tests
1 parent 5567f21 commit 6fd694c

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

tests/tox_env/test_cachedir_tag.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
from __future__ import annotations
2+
3+
from typing import TYPE_CHECKING
4+
5+
if TYPE_CHECKING:
6+
from tox.pytest import ToxProjectCreator
7+
8+
9+
def test_cachedir_tag_created_in_new_workdir(tox_project: ToxProjectCreator) -> None:
10+
prj = tox_project({"tox.ini": "[testenv]\ncommands=python --version"})
11+
cwd = prj.path
12+
assert not (cwd / ".tox").exists()
13+
result = prj.run("run", from_cwd=cwd)
14+
result.assert_success()
15+
print(list((cwd / ".tox").iterdir()))
16+
assert (cwd / ".tox" / "CACHEDIR.TAG").exists()
17+
18+
19+
def test_cachedir_tag_not_created_in_extant_workdir(tox_project: ToxProjectCreator, tmp_path) -> None:
20+
workdir = tmp_path / "workworkwork"
21+
workdir.mkdir(parents=True)
22+
prj = tox_project({"tox.ini": "[testenv]\ncommands=python --version"})
23+
result = prj.run("--workdir", str(workdir), from_cwd=prj.path.parent)
24+
result.assert_success()
25+
assert not (workdir / "CACHEDIR.TAG").exists()

0 commit comments

Comments
 (0)