Skip to content

Commit b67b409

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

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

tests/tox_env/test_cachedir_tag.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
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+
assert (cwd / ".tox" / "CACHEDIR.TAG").exists()
16+
17+
18+
def test_cachedir_tag_not_created_in_extant_workdir(tox_project: ToxProjectCreator, tmp_path) -> None:
19+
workdir = tmp_path / "workworkwork"
20+
workdir.mkdir(parents=True)
21+
prj = tox_project({"tox.ini": "[testenv]\ncommands=python --version"})
22+
result = prj.run("--workdir", str(workdir), from_cwd=prj.path.parent)
23+
result.assert_success()
24+
assert not (workdir / "CACHEDIR.TAG").exists()

0 commit comments

Comments
 (0)