Replace cleanup_numbered_dir with atexit.register
This commit is contained in:
parent
c871d8b2b6
commit
bde0ebcda9
1
AUTHORS
1
AUTHORS
|
@ -227,6 +227,7 @@ Pedro Algarvio
|
|||
Philipp Loose
|
||||
Pieter Mulder
|
||||
Piotr Banaszkiewicz
|
||||
Piotr Helm
|
||||
Prashant Anand
|
||||
Pulkit Goyal
|
||||
Punyashloka Biswal
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
Fix issue where directories from tmpdir are not removed properly when multiple instances of pytest are running in parallel.
|
|
@ -338,11 +338,13 @@ def make_numbered_dir_with_cleanup(
|
|||
e = exc
|
||||
else:
|
||||
consider_lock_dead_if_created_before = p.stat().st_mtime - lock_timeout
|
||||
cleanup_numbered_dir(
|
||||
root=root,
|
||||
prefix=prefix,
|
||||
keep=keep,
|
||||
consider_lock_dead_if_created_before=consider_lock_dead_if_created_before,
|
||||
# Register a cleanup for program exit
|
||||
atexit.register(
|
||||
cleanup_numbered_dir,
|
||||
root,
|
||||
prefix,
|
||||
keep,
|
||||
consider_lock_dead_if_created_before,
|
||||
)
|
||||
return p
|
||||
assert e is not None
|
||||
|
|
Loading…
Reference in New Issue