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

Method check

src/xdist/looponfail.py:269–299  ·  view source on GitHub ↗
(self, removepycfiles: bool = True)

Source from the content-addressed store, hash-verified

267 time.sleep(checkinterval)
268
269 def check(self, removepycfiles: bool = True) -> bool:
270 changed = False
271 newstat: dict[Path, os.stat_result] = {}
272 for rootdir in self.rootdirlist:
273 for path in visit_path(rootdir, filter=self.fil, recurse=self.rec):
274 oldstat = self.statcache.pop(path, None)
275 try:
276 curstat = path.stat()
277 except OSError:
278 if oldstat:
279 changed = True
280 else:
281 newstat[path] = curstat
282 if oldstat is not None:
283 if (
284 oldstat.st_mtime != curstat.st_mtime
285 or oldstat.st_size != curstat.st_size
286 ):
287 changed = True
288 print("# MODIFIED", path)
289 if removepycfiles and path.suffix == ".py":
290 pycfile = path.with_suffix(".pyc")
291 if pycfile.is_file():
292 os.unlink(pycfile)
293
294 else:
295 changed = True
296 if self.statcache:
297 changed = True
298 self.statcache = newstat
299 return changed

Callers 5

__init__Method · 0.95
waitonchangeMethod · 0.95
test_filechangeMethod · 0.95
test_pycremovalMethod · 0.95

Calls 1

visit_pathFunction · 0.90

Tested by 3

test_filechangeMethod · 0.76
test_pycremovalMethod · 0.76