Skip to content

fix tmp_path retention for setup and teardown errors - #15078

Open
qinpei-dev wants to merge 1 commit into
pytest-dev:mainfrom
qinpei-dev:fix/tmp-path-retention-errors
Open

qinpei-dev wants to merge 1 commit into
pytest-dev:mainfrom
qinpei-dev:fix/tmp-path-retention-errors

Conversation

@qinpei-dev

Copy link
Copy Markdown

tmp_path_retention_policy = "failed" currently removes temporary directories when failures occur during setup or teardown.

Cleanup previously happened before the teardown report was available.

This change defers the cleanup decision until teardown reporting and retains directories when setup, call, or teardown failed.

Regression coverage includes setup error, call failure, teardown error, skip, and pass.

Fixes #14998

@qinpei-dev

Copy link
Copy Markdown
Author

The only failing required check is the PyPy xdist job.

The failure occurs in:
testing/python/metafunc.py::TestMetafunc::test_idval_hypothesis

with:
RuntimeWarning: cython.collection_type only works on PyPy with the C flag CYTHON_USE_TYPE_SPECS=1

I investigated the failure and it appears unrelated to this PR. This change only modifies tmp_path retention behavior in src/_pytest/tmpdir.py and adds regression tests in testing/test_tmpdir.py.

All tmp_path-related tests and the main build matrix are passing.

I will leave the unrelated PyPy failure unchanged unless maintainers prefer otherwise.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

tmp_path_retention_policy="failed" removes directories for setup and teardown errors

1 participant