mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-08-13 16:54:45 +03:00
Do not import from Tests directory
This commit is contained in:
parent
5a90fb81cb
commit
f69c221376
|
@ -1,6 +1,7 @@
|
|||
#!/usr/bin/env python3
|
||||
from __future__ import annotations
|
||||
|
||||
import sys
|
||||
from collections.abc import Callable
|
||||
from typing import Any
|
||||
|
||||
|
@ -8,12 +9,12 @@ import pytest
|
|||
|
||||
from PIL import Image
|
||||
|
||||
from .helper import is_win32
|
||||
|
||||
min_iterations = 100
|
||||
max_iterations = 10000
|
||||
|
||||
pytestmark = pytest.mark.skipif(is_win32(), reason="requires Unix or macOS")
|
||||
pytestmark = pytest.mark.skipif(
|
||||
sys.platform.startswith("win32"), reason="requires Unix or macOS"
|
||||
)
|
||||
|
||||
|
||||
def _get_mem_usage() -> float:
|
||||
|
|
|
@ -1,12 +1,11 @@
|
|||
from __future__ import annotations
|
||||
|
||||
import sys
|
||||
from io import BytesIO
|
||||
|
||||
import pytest
|
||||
|
||||
from PIL import Image
|
||||
|
||||
from .helper import is_win32, skip_unless_feature
|
||||
from PIL import Image, features
|
||||
|
||||
# Limits for testing the leak
|
||||
mem_limit = 1024 * 1048576
|
||||
|
@ -15,8 +14,10 @@ iterations = int((mem_limit / stack_size) * 2)
|
|||
test_file = "Tests/images/rgb_trns_ycbc.jp2"
|
||||
|
||||
pytestmark = [
|
||||
pytest.mark.skipif(is_win32(), reason="requires Unix or macOS"),
|
||||
skip_unless_feature("jpg_2000"),
|
||||
pytest.mark.skipif(
|
||||
sys.platform.startswith("win32"), reason="requires Unix or macOS"
|
||||
),
|
||||
pytest.mark.skipif(not features.check("jpg_2000"), reason="jpg_2000 not available"),
|
||||
]
|
||||
|
||||
|
||||
|
|
|
@ -1,10 +1,11 @@
|
|||
from __future__ import annotations
|
||||
|
||||
import sys
|
||||
from io import BytesIO
|
||||
|
||||
import pytest
|
||||
|
||||
from .helper import hopper, is_win32
|
||||
from PIL import Image
|
||||
|
||||
iterations = 5000
|
||||
|
||||
|
@ -18,7 +19,9 @@ valgrind --tool=massif python test-installed.py -s -v checks/check_jpeg_leaks.py
|
|||
"""
|
||||
|
||||
|
||||
pytestmark = pytest.mark.skipif(is_win32(), reason="requires Unix or macOS")
|
||||
pytestmark = pytest.mark.skipif(
|
||||
sys.platform.startswith("win32"), reason="requires Unix or macOS"
|
||||
)
|
||||
|
||||
"""
|
||||
pre patch:
|
||||
|
@ -112,7 +115,7 @@ standard_chrominance_qtable = (
|
|||
),
|
||||
)
|
||||
def test_qtables_leak(qtables: tuple[tuple[int, ...]] | list[tuple[int, ...]]) -> None:
|
||||
im = hopper("RGB")
|
||||
with Image.open("Tests/images/hopper.ppm") as im:
|
||||
for _ in range(iterations):
|
||||
test_output = BytesIO()
|
||||
im.save(test_output, "JPEG", qtables=qtables)
|
||||
|
@ -173,9 +176,9 @@ def test_exif_leak() -> None:
|
|||
0 +----------------------------------------------------------------------->Gi
|
||||
0 11.33
|
||||
"""
|
||||
im = hopper("RGB")
|
||||
exif = b"12345678" * 4096
|
||||
|
||||
with Image.open("Tests/images/hopper.ppm") as im:
|
||||
for _ in range(iterations):
|
||||
test_output = BytesIO()
|
||||
im.save(test_output, "JPEG", exif=exif)
|
||||
|
@ -207,8 +210,7 @@ def test_base_save() -> None:
|
|||
| :@ @@ @ # : : :: :: @:: :::: :::: :::: : : : : : : :::::::::::: :::@:::
|
||||
0 +----------------------------------------------------------------------->Gi
|
||||
0 7.882"""
|
||||
im = hopper("RGB")
|
||||
|
||||
with Image.open("Tests/images/hopper.ppm") as im:
|
||||
for _ in range(iterations):
|
||||
test_output = BytesIO()
|
||||
im.save(test_output, "JPEG")
|
||||
|
|
Loading…
Reference in New Issue
Block a user