mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-02-23 07:10:33 +03:00
Test unexpected end of tar file
This commit is contained in:
parent
8a3c4f5965
commit
9762c9e30e
|
@ -1,6 +1,7 @@
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
import warnings
|
import warnings
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
|
@ -29,6 +30,16 @@ def test_sanity(codec: str, test_path: str, format: str) -> None:
|
||||||
assert im.format == format
|
assert im.format == format
|
||||||
|
|
||||||
|
|
||||||
|
def test_unexpected_end(tmp_path: Path) -> None:
|
||||||
|
tmpfile = str(tmp_path / "temp.tar")
|
||||||
|
with open(tmpfile, "w"):
|
||||||
|
pass
|
||||||
|
|
||||||
|
with pytest.raises(OSError):
|
||||||
|
with TarIO.TarIO(tmpfile, "test"):
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.skipif(is_pypy(), reason="Requires CPython")
|
@pytest.mark.skipif(is_pypy(), reason="Requires CPython")
|
||||||
def test_unclosed_file() -> None:
|
def test_unclosed_file() -> None:
|
||||||
with pytest.warns(ResourceWarning):
|
with pytest.warns(ResourceWarning):
|
||||||
|
|
Loading…
Reference in New Issue
Block a user