Fix the name of the attribute

This commit is contained in:
Yusuke Kadowaki 2022-11-03 20:29:56 +09:00
parent 94740c0336
commit dc11283794
1 changed files with 2 additions and 2 deletions

View File

@ -272,7 +272,7 @@ def tmp_path(
# Remove the tmpdir if the policy is "failed" and the test passed. # Remove the tmpdir if the policy is "failed" and the test passed.
tmp_path_factory: TempPathFactory = request.session.config._tmp_path_factory # type: ignore tmp_path_factory: TempPathFactory = request.session.config._tmp_path_factory # type: ignore
policy = tmp_path_factory._retention_policy policy = tmp_path_factory._retention_policy
if policy == "failed" and request.node.result_call.passed: if policy == "failed" and request.node._tmp_path_result_call.passed:
# 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(path, ignore_errors=True) rmtree(path, ignore_errors=True)
@ -311,4 +311,4 @@ def pytest_sessionfinish(session, exitstatus: Union[int, ExitCode]):
def pytest_runtest_makereport(item, call): def pytest_runtest_makereport(item, call):
outcome = yield outcome = yield
result = outcome.get_result() result = outcome.get_result()
setattr(item, "result_" + result.when, result) setattr(item, "_tmp_path_result_" + result.when, result)