MCPcopy
hub / github.com/gorakhargosh/watchdog / test_move_internal_batch

Function test_move_internal_batch

tests/test_inotify_buffer.py:69–89  ·  view source on GitHub ↗
(p)

Source from the content-addressed store, hash-verified

67
68@pytest.mark.timeout(10)
69def test_move_internal_batch(p):
70 n = 100
71 mkdir(p("dir1"))
72 mkdir(p("dir2"))
73 files = [str(i) for i in range(n)]
74 for f in files:
75 touch(p("dir1", f))
76
77 inotify = InotifyBuffer(p("").encode(), recursive=True)
78
79 random.shuffle(files)
80 for f in files:
81 mv(p("dir1", f), p("dir2", f))
82
83 # Check that all n events are paired
84 for _ in range(n):
85 frm, to = wait_for_move_event(inotify.read_event)
86 assert os.path.dirname(frm.src_path).endswith(b"/dir1")
87 assert os.path.dirname(to.src_path).endswith(b"/dir2")
88 assert frm.name == to.name
89 inotify.close()
90
91
92@pytest.mark.timeout(5)

Callers

nothing calls this directly

Calls 7

closeMethod · 0.95
InotifyBufferClass · 0.90
mkdirFunction · 0.85
touchFunction · 0.85
mvFunction · 0.85
wait_for_move_eventFunction · 0.85
pFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…