Update tmpdir.py
This commit is contained in:
parent
2d01dbd07a
commit
ae6eac77bb
|
@ -299,20 +299,19 @@ def pytest_sessionfinish(session, exitstatus: Union[int, ExitCode]):
|
||||||
if basetemp is None:
|
if basetemp is None:
|
||||||
return
|
return
|
||||||
|
|
||||||
# Remove dead symlinks.
|
|
||||||
cleanup_dead_symlinks(basetemp)
|
|
||||||
|
|
||||||
policy = tmp_path_factory._retention_policy
|
policy = tmp_path_factory._retention_policy
|
||||||
if (
|
if (
|
||||||
exitstatus == 0
|
exitstatus == 0
|
||||||
and policy == "failed"
|
and policy == "failed"
|
||||||
and tmp_path_factory._given_basetemp is None
|
and tmp_path_factory._given_basetemp is None
|
||||||
):
|
):
|
||||||
passed_dir = basetemp
|
if basetemp.exists():
|
||||||
if passed_dir.exists():
|
|
||||||
# We do a "best effort" to remove files, but it might not be possible due to some leaked resource,
|
# We do a "best effort" to remove files, but it might not be possible due to some leaked resource,
|
||||||
# permissions, etc, in which case we ignore it.
|
# permissions, etc, in which case we ignore it.
|
||||||
rmtree(passed_dir, ignore_errors=True)
|
rmtree(passed_dir, ignore_errors=True)
|
||||||
|
|
||||||
|
# Remove dead symlinks.
|
||||||
|
cleanup_dead_symlinks(basetemp)
|
||||||
|
|
||||||
|
|
||||||
@hookimpl(tryfirst=True, hookwrapper=True)
|
@hookimpl(tryfirst=True, hookwrapper=True)
|
||||||
|
|
Loading…
Reference in New Issue