Skip to content

Conversation

@radarhere
Copy link
Member

When testing TarIO errors, the file handle is not closed - https://github.com/python-pillow/Pillow/actions/runs/14155530774/job/39654267057?pr=8844#step:6:5611

Tests/test_file_tar.py::test_unexpected_end
  /Pillow/Tests/test_file_tar.py:38: ResourceWarning: unclosed file <_io.BufferedReader name='/tmp/pytest-of-pillow/pytest-0/test_unexpected_end0/temp.tar'>
    with pytest.raises(OSError, match="unexpected end of tar file"):
  Enable tracemalloc to get traceback where the object was allocated.
  See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info.

Tests/test_file_tar.py::test_cannot_find_subfile
  /Pillow/Tests/test_file_tar.py:44: ResourceWarning: unclosed file <_io.BufferedReader name='Tests/images/hopper.tar'>
    with pytest.raises(OSError, match="cannot find subfile"):
  Enable tracemalloc to get traceback where the object was allocated.
  See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info.

This fixes that.

@hugovk hugovk merged commit f673f3e into python-pillow:main Mar 30, 2025
55 checks passed
@radarhere radarhere deleted the tario branch March 30, 2025 20:22
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.

2 participants