MCPcopy
hub / github.com/pytest-dev/pytest-xdist / test_filechange

Method test_filechange

testing/test_looponfail.py:17–55  ·  view source on GitHub ↗
(self, tmp_path: Path)

Source from the content-addressed store, hash-verified

15
16class TestStatRecorder:
17 def test_filechange(self, tmp_path: Path) -> None:
18 tmp = tmp_path
19 hello = tmp / "hello.py"
20 hello.touch()
21 sd = StatRecorder([tmp])
22 changed = sd.check()
23 assert not changed
24
25 hello.write_text("world")
26 changed = sd.check()
27 assert changed
28
29 hello.with_suffix(".pyc").write_text("hello")
30 changed = sd.check()
31 assert not changed
32
33 p = tmp / "new.py"
34 p.touch()
35 changed = sd.check()
36 assert changed
37
38 p.unlink()
39 changed = sd.check()
40 assert changed
41
42 tmp.joinpath("a", "b").mkdir(parents=True)
43 tmp.joinpath("a", "b", "c.py").touch()
44 changed = sd.check()
45 assert changed
46
47 tmp.joinpath("a", "c.txt").touch()
48 changed = sd.check()
49 assert changed
50 changed = sd.check()
51 assert not changed
52
53 shutil.rmtree(str(tmp.joinpath("a")))
54 changed = sd.check()
55 assert changed
56
57 def test_dirchange(self, tmp_path: Path) -> None:
58 tmp = tmp_path

Callers

nothing calls this directly

Calls 2

checkMethod · 0.95
StatRecorderClass · 0.90

Tested by

no test coverage detected