Fix not to delete directory when policy is

This commit is contained in:
Yusuke Kadowaki 2022-11-23 16:55:54 +09:00
parent e59d7557d4
commit e571e09f59
1 changed files with 1 additions and 2 deletions

View File

@ -281,8 +281,7 @@ def tmp_path(
policy = tmp_path_factory._retention_policy
result_dict = request.node.stash[tmppath_result_key]
# "call" might be skipped so check if it exists first
if "call" not in result_dict or (policy == "failed" and result_dict["call"]):
if policy == "failed" and result_dict.get("call", True):
# 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.
rmtree(path, ignore_errors=True)