MCPcopy
hub / github.com/pytest-dev/pytest / try_remove_lockfile

Method try_remove_lockfile

src/_pytest/_py/path.py:1316–1327  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1314 mypid = os.getpid()
1315
1316 def try_remove_lockfile():
1317 # in a fork() situation, only the last process should
1318 # remove the .lock, otherwise the other processes run the
1319 # risk of seeing their temporary dir disappear. For now
1320 # we remove the .lock in the parent only (i.e. we assume
1321 # that the children finish before the parent).
1322 if os.getpid() != mypid:
1323 return
1324 try:
1325 lockfile.remove()
1326 except error.Error:
1327 pass
1328
1329 atexit.register(try_remove_lockfile)
1330

Callers

nothing calls this directly

Calls 1

removeMethod · 0.80

Tested by

no test coverage detected