Import unittest from stdlib rather than helper.py

The unittest in helper.py has not offered an interesting abstraction
since dbe9f85c7d so import from the more
typical stdlib location.
This commit is contained in:
Jon Dufresne 2019-11-20 18:42:52 -08:00
parent f90a21965a
commit 33dabf986f
45 changed files with 108 additions and 45 deletions

View File

@ -1,8 +1,9 @@
import time
import unittest
from PIL import PyAccess
from .helper import PillowTestCase, hopper, unittest
from .helper import PillowTestCase, hopper
# Not running this test by default. No DOS against Travis CI.

View File

@ -1,6 +1,8 @@
import unittest
from PIL import Image
from .helper import PillowTestCase, unittest
from .helper import PillowTestCase
TEST_FILE = "Tests/images/fli_overflow.fli"

View File

@ -1,7 +1,9 @@
#!/usr/bin/env python
import unittest
from PIL import Image
from .helper import PillowTestCase, is_win32, unittest
from .helper import PillowTestCase, is_win32
min_iterations = 100
max_iterations = 10000

View File

@ -1,8 +1,9 @@
import unittest
from io import BytesIO
from PIL import Image
from .helper import PillowTestCase, is_win32, unittest
from .helper import PillowTestCase, is_win32
# Limits for testing the leak
mem_limit = 1024 * 1048576

View File

@ -1,6 +1,8 @@
import unittest
from PIL import Image
from .helper import PillowTestCase, unittest
from .helper import PillowTestCase
class TestJ2kEncodeOverflow(PillowTestCase):

View File

@ -1,6 +1,7 @@
import unittest
from io import BytesIO
from .helper import PillowTestCase, hopper, is_win32, unittest
from .helper import PillowTestCase, hopper, is_win32
iterations = 5000

View File

@ -1,8 +1,9 @@
import sys
import unittest
from PIL import Image
from .helper import PillowTestCase, unittest
from .helper import PillowTestCase
# This test is not run automatically.
#

View File

@ -1,8 +1,9 @@
import sys
import unittest
from PIL import Image
from .helper import PillowTestCase, unittest
from .helper import PillowTestCase
# This test is not run automatically.
#

View File

@ -1,6 +1,8 @@
import unittest
from PIL import Image
from .helper import PillowTestCase, unittest
from .helper import PillowTestCase
TEST_FILE = "Tests/images/libtiff_segfault.tif"

View File

@ -1,9 +1,10 @@
import unittest
import zlib
from io import BytesIO
from PIL import Image, ImageFile, PngImagePlugin
from .helper import PillowTestCase, unittest
from .helper import PillowTestCase
TEST_FILE = "Tests/images/png_decompression_dos.png"

View File

@ -1,8 +1,9 @@
import unittest
from array import array
from PIL import Image, ImageFilter
from .helper import PillowTestCase, unittest
from .helper import PillowTestCase
try:
import numpy

View File

@ -1,8 +1,9 @@
import sys
import unittest
from PIL import Image
from .helper import PillowTestCase, is_pypy, unittest
from .helper import PillowTestCase, is_pypy
class TestCoreStats(PillowTestCase):

View File

@ -1,8 +1,9 @@
import io
import unittest
from PIL import features
from .helper import PillowTestCase, unittest
from .helper import PillowTestCase
try:
from PIL import _webp

View File

@ -1,8 +1,9 @@
import io
import unittest
from PIL import EpsImagePlugin, Image
from .helper import PillowTestCase, hopper, unittest
from .helper import PillowTestCase, hopper
HAS_GHOSTSCRIPT = EpsImagePlugin.has_ghostscript()

View File

@ -1,4 +1,6 @@
from .helper import PillowTestCase, unittest
import unittest
from .helper import PillowTestCase
try:
from PIL import FpxImagePlugin

View File

@ -1,8 +1,9 @@
import unittest
from io import BytesIO
from PIL import GifImagePlugin, Image, ImageDraw, ImagePalette
from .helper import PillowTestCase, hopper, is_pypy, netpbm_available, unittest
from .helper import PillowTestCase, hopper, is_pypy, netpbm_available
try:
from PIL import _webp

View File

@ -1,9 +1,10 @@
import io
import sys
import unittest
from PIL import IcnsImagePlugin, Image
from .helper import PillowTestCase, unittest
from .helper import PillowTestCase
# sample icon file
TEST_FILE = "Tests/images/pillow.icns"

View File

@ -1,6 +1,8 @@
import unittest
from PIL import Image, ImagePalette, features
from .helper import PillowTestCase, hopper, unittest
from .helper import PillowTestCase, hopper
try:
from PIL import MicImagePlugin

View File

@ -1,8 +1,9 @@
import os
import unittest
from PIL import Image, MspImagePlugin
from .helper import PillowTestCase, hopper, unittest
from .helper import PillowTestCase, hopper
TEST_FILE = "Tests/images/hopper.msp"
EXTRA_DIR = "Tests/images/picins"

View File

@ -1,9 +1,10 @@
import unittest
import zlib
from io import BytesIO
from PIL import Image, ImageFile, PngImagePlugin
from .helper import PillowLeakTestCase, PillowTestCase, hopper, is_win32, unittest
from .helper import PillowLeakTestCase, PillowTestCase, hopper, is_win32
try:
from PIL import _webp

View File

@ -1,8 +1,9 @@
import os
import unittest
from PIL import Image, SunImagePlugin
from .helper import PillowTestCase, hopper, unittest
from .helper import PillowTestCase, hopper
EXTRA_DIR = "Tests/images/sunraster"

View File

@ -1,12 +1,13 @@
import logging
import os
import unittest
from io import BytesIO
import pytest
from PIL import Image, TiffImagePlugin
from PIL.TiffImagePlugin import RESOLUTION_UNIT, X_RESOLUTION, Y_RESOLUTION
from .helper import PillowTestCase, hopper, is_pypy, is_win32, unittest
from .helper import PillowTestCase, hopper, is_pypy, is_win32
logger = logging.getLogger(__name__)

View File

@ -1,6 +1,8 @@
import unittest
from PIL import Image, WebPImagePlugin
from .helper import PillowTestCase, hopper, unittest
from .helper import PillowTestCase, hopper
try:
from PIL import _webp

View File

@ -1,6 +1,8 @@
import unittest
from PIL import Image
from .helper import PillowTestCase, hopper, unittest
from .helper import PillowTestCase, hopper
try:
from PIL import _webp

View File

@ -1,6 +1,8 @@
import unittest
from PIL import Image, ImageDraw, ImageFont, features
from .helper import PillowLeakTestCase, is_win32, unittest
from .helper import PillowLeakTestCase, is_win32
@unittest.skipIf(is_win32(), "requires Unix or macOS")

View File

@ -1,10 +1,11 @@
import os
import shutil
import tempfile
import unittest
from PIL import Image, UnidentifiedImageError
from .helper import PillowTestCase, hopper, is_win32, unittest
from .helper import PillowTestCase, hopper, is_win32
class TestImage(PillowTestCase):

View File

@ -2,11 +2,12 @@ import ctypes
import os
import subprocess
import sys
import unittest
from distutils import ccompiler, sysconfig
from PIL import Image
from .helper import PillowTestCase, hopper, is_win32, on_ci, unittest
from .helper import PillowTestCase, hopper, is_win32, on_ci
# CFFI imports pycparser which doesn't support PYTHONOPTIMIZE=2
# https://github.com/eliben/pycparser/pull/198#issuecomment-317001670

View File

@ -1,8 +1,9 @@
import unittest
from contextlib import contextmanager
from PIL import Image, ImageDraw
from .helper import PillowTestCase, hopper, unittest
from .helper import PillowTestCase, hopper
class TestImagingResampleVulnerability(PillowTestCase):

View File

@ -1,8 +1,9 @@
import os.path
import unittest
from PIL import Image, ImageColor, ImageDraw, ImageFont, features
from .helper import PillowTestCase, hopper, unittest
from .helper import PillowTestCase, hopper
BLACK = (0, 0, 0)
WHITE = (255, 255, 255)

View File

@ -1,8 +1,9 @@
import os.path
import unittest
from PIL import Image, ImageDraw2, features
from .helper import PillowTestCase, hopper, unittest
from .helper import PillowTestCase, hopper
BLACK = (0, 0, 0)
WHITE = (255, 255, 255)

View File

@ -1,8 +1,9 @@
import unittest
from io import BytesIO
from PIL import EpsImagePlugin, Image, ImageFile
from .helper import PillowTestCase, fromstring, hopper, tostring, unittest
from .helper import PillowTestCase, fromstring, hopper, tostring
try:
from PIL import _webp

View File

@ -4,11 +4,12 @@ import os
import re
import shutil
import sys
import unittest
from io import BytesIO
from PIL import Image, ImageDraw, ImageFont, features
from .helper import PillowTestCase, is_pypy, is_win32, unittest
from .helper import PillowTestCase, is_pypy, is_win32
FONT_PATH = "Tests/fonts/FreeMono.ttf"
FONT_SIZE = 20

View File

@ -1,6 +1,8 @@
import unittest
from PIL import Image, ImageDraw, ImageFont
from .helper import PillowTestCase, unittest
from .helper import PillowTestCase
image_font_installed = True
try:

View File

@ -1,6 +1,8 @@
import unittest
from PIL import Image, ImageDraw, ImageFont, features
from .helper import PillowTestCase, unittest
from .helper import PillowTestCase
FONT_SIZE = 20
FONT_PATH = "Tests/fonts/DejaVuSans.ttf"

View File

@ -1,6 +1,8 @@
import unittest
from PIL import Image, ImageShow
from .helper import PillowTestCase, hopper, is_win32, on_ci, on_github_actions, unittest
from .helper import PillowTestCase, hopper, is_win32, on_ci, on_github_actions
class TestImageShow(PillowTestCase):

View File

@ -1,6 +1,8 @@
import unittest
from PIL import Image
from .helper import PillowTestCase, hopper, unittest
from .helper import PillowTestCase, hopper
try:
from PIL import ImageTk

View File

@ -1,6 +1,8 @@
import unittest
from PIL import ImageWin
from .helper import PillowTestCase, hopper, is_win32, unittest
from .helper import PillowTestCase, hopper, is_win32
class TestImageWin(PillowTestCase):

View File

@ -1,6 +1,8 @@
import unittest
from PIL import Image
from .helper import PillowTestCase, unittest
from .helper import PillowTestCase
class TestLibImage(PillowTestCase):

View File

@ -1,8 +1,9 @@
import locale
import unittest
from PIL import Image
from .helper import PillowTestCase, unittest
from .helper import PillowTestCase
# ref https://github.com/python-pillow/Pillow/issues/272
# on windows, in polish locale:

View File

@ -1,9 +1,10 @@
import os
import subprocess
import sys
import unittest
from unittest import TestCase
from .helper import is_pypy, is_win32, on_github_actions, unittest
from .helper import is_pypy, is_win32, on_github_actions
class TestMain(TestCase):

View File

@ -1,8 +1,9 @@
import sys
import unittest
from PIL import Image
from .helper import PillowTestCase, is_win32, unittest
from .helper import PillowTestCase, is_win32
try:
import numpy

View File

@ -1,6 +1,8 @@
import unittest
from PIL import Image
from .helper import PillowTestCase, hopper, unittest
from .helper import PillowTestCase, hopper
try:
import numpy

View File

@ -1,6 +1,8 @@
import unittest
from PIL import __version__
from .helper import PillowTestCase, unittest
from .helper import PillowTestCase
try:
import pyroma

View File

@ -1,6 +1,8 @@
import unittest
from PIL import _util
from .helper import PillowTestCase, unittest
from .helper import PillowTestCase
class TestUtil(PillowTestCase):

View File

@ -1,8 +1,9 @@
import unittest
from io import BytesIO
from PIL import Image, features
from .helper import PillowLeakTestCase, unittest
from .helper import PillowLeakTestCase
test_file = "Tests/images/hopper.webp"