Improve pytest configuration to allow specific tests as CLI args

The previous test configuration made it difficult to run a single test
with the pytest CLI. There were two major issues:

- The Tests directory was not a package. It now includes a __init__.py
  file and imports from other tests modules are done with relative
  imports.

- setup.cfg always specified the Tests directory. So even if a specific
  test were specified as a CLI arg, this configuration would also always
  include all tests. This configuration has been removed to allow
  specifying a single test on the command line.

Contributors can now run specific tests with a single command such as:

  $ tox -e py37 -- Tests/test_file_pdf.py::TestFilePdf.test_rgb

This makes it easy and faster to iterate on a single test failure and is
very familiar to those that have previously used tox and pytest.

When running tox or pytest with no arguments, they still discover and
runs all tests in the Tests directory.
This commit is contained in:
Jon Dufresne 2019-01-13 09:00:12 -08:00
parent b62ff510aa
commit 7da17ad41e
161 changed files with 167 additions and 170 deletions

0
Tests/__init__.py Normal file
View File

View File

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

View File

@ -1,4 +1,4 @@
import helper from . import helper
import timeit import timeit
import sys import sys

View File

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

View File

@ -1,7 +1,7 @@
#!/usr/bin/env python #!/usr/bin/env python
from __future__ import division from __future__ import division
from helper import unittest, PillowTestCase from .helper import unittest, PillowTestCase
import sys import sys
from PIL import Image from PIL import Image

View File

@ -1,4 +1,4 @@
from helper import unittest, PillowTestCase from .helper import unittest, PillowTestCase
import sys import sys
from PIL import Image from PIL import Image
from io import BytesIO from io import BytesIO

View File

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

View File

@ -1,4 +1,4 @@
from helper import unittest, PillowTestCase, hopper from .helper import unittest, PillowTestCase, hopper
from io import BytesIO from io import BytesIO
import sys import sys

View File

@ -1,6 +1,6 @@
import sys import sys
from helper import unittest, PillowTestCase from .helper import unittest, PillowTestCase
# This test is not run automatically. # This test is not run automatically.
# #

View File

@ -1,6 +1,6 @@
import sys import sys
from helper import unittest, PillowTestCase from .helper import unittest, PillowTestCase
# This test is not run automatically. # This test is not run automatically.
# #

View File

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

View File

@ -1,4 +1,4 @@
from helper import unittest, PillowTestCase from .helper import unittest, PillowTestCase
from PIL import Image, PngImagePlugin, ImageFile from PIL import Image, PngImagePlugin, ImageFile
from io import BytesIO from io import BytesIO
import zlib import zlib

View File

@ -1,4 +1,4 @@
from helper import unittest, PillowTestCase from .helper import unittest, PillowTestCase
import PIL import PIL
import PIL.Image import PIL.Image

View File

@ -1,4 +1,4 @@
from helper import unittest, PillowTestCase from .helper import unittest, PillowTestCase
from PIL import _binary from PIL import _binary

View File

@ -1,5 +1,5 @@
from __future__ import print_function from __future__ import print_function
from helper import unittest, PillowTestCase from .helper import unittest, PillowTestCase
from PIL import Image from PIL import Image
import os import os

View File

@ -1,4 +1,4 @@
from helper import unittest, PillowTestCase from .helper import unittest, PillowTestCase
from PIL import Image, ImageFilter from PIL import Image, ImageFilter

View File

@ -3,7 +3,7 @@ from __future__ import division
from array import array from array import array
from PIL import Image, ImageFilter from PIL import Image, ImageFilter
from helper import unittest, PillowTestCase from .helper import unittest, PillowTestCase
try: try:
import numpy import numpy

View File

@ -2,7 +2,7 @@ from __future__ import division, print_function
import sys import sys
from helper import unittest, PillowTestCase from .helper import unittest, PillowTestCase
from PIL import Image from PIL import Image

View File

@ -1,4 +1,4 @@
from helper import unittest, PillowTestCase, hopper from .helper import unittest, PillowTestCase, hopper
from PIL import Image from PIL import Image

View File

@ -1,4 +1,4 @@
from helper import unittest, PillowTestCase from .helper import unittest, PillowTestCase
from PIL import features from PIL import features

View File

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

View File

@ -1,4 +1,4 @@
from helper import unittest, PillowTestCase, hopper from .helper import unittest, PillowTestCase, hopper
from PIL import Image, BmpImagePlugin from PIL import Image, BmpImagePlugin
import io import io

View File

@ -1,4 +1,4 @@
from helper import unittest, PillowTestCase, hopper from .helper import unittest, PillowTestCase, hopper
from PIL import BufrStubImagePlugin, Image from PIL import BufrStubImagePlugin, Image

View File

@ -1,4 +1,4 @@
from helper import unittest, PillowTestCase, hopper from .helper import unittest, PillowTestCase, hopper
from PIL import Image from PIL import Image
from PIL import ContainerIO from PIL import ContainerIO

View File

@ -1,4 +1,4 @@
from helper import unittest, PillowTestCase from .helper import unittest, PillowTestCase
from PIL import Image, CurImagePlugin from PIL import Image, CurImagePlugin

View File

@ -1,4 +1,4 @@
from helper import unittest, PillowTestCase, hopper from .helper import unittest, PillowTestCase, hopper
from PIL import Image, DcxImagePlugin from PIL import Image, DcxImagePlugin

View File

@ -1,6 +1,6 @@
from io import BytesIO from io import BytesIO
from helper import unittest, PillowTestCase from .helper import unittest, PillowTestCase
from PIL import Image, DdsImagePlugin from PIL import Image, DdsImagePlugin
TEST_FILE_DXT1 = "Tests/images/dxt1-rgb-4bbp-noalpha_MipMaps-1.dds" TEST_FILE_DXT1 = "Tests/images/dxt1-rgb-4bbp-noalpha_MipMaps-1.dds"

View File

@ -1,4 +1,4 @@
from helper import unittest, PillowTestCase, hopper from .helper import unittest, PillowTestCase, hopper
from PIL import Image, EpsImagePlugin from PIL import Image, EpsImagePlugin
import io import io

View File

@ -1,4 +1,4 @@
from helper import unittest, PillowTestCase from .helper import unittest, PillowTestCase
from PIL import FitsStubImagePlugin, Image from PIL import FitsStubImagePlugin, Image

View File

@ -1,4 +1,4 @@
from helper import unittest, PillowTestCase from .helper import unittest, PillowTestCase
from PIL import Image, FliImagePlugin from PIL import Image, FliImagePlugin

View File

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

View File

@ -1,4 +1,4 @@
from helper import unittest, PillowTestCase from .helper import unittest, PillowTestCase
from PIL import Image from PIL import Image

View File

@ -1,4 +1,4 @@
from helper import unittest, PillowTestCase from .helper import unittest, PillowTestCase
from PIL import Image, GbrImagePlugin from PIL import Image, GbrImagePlugin

View File

@ -1,4 +1,4 @@
from helper import unittest, PillowTestCase from .helper import unittest, PillowTestCase
from PIL import GdImageFile from PIL import GdImageFile

View File

@ -1,4 +1,4 @@
from helper import unittest, PillowTestCase, hopper, netpbm_available from .helper import unittest, PillowTestCase, hopper, netpbm_available
from PIL import Image, ImagePalette, GifImagePlugin from PIL import Image, ImagePalette, GifImagePlugin

View File

@ -1,4 +1,4 @@
from helper import unittest, PillowTestCase from .helper import unittest, PillowTestCase
from PIL import GimpGradientFile from PIL import GimpGradientFile

View File

@ -1,4 +1,4 @@
from helper import unittest, PillowTestCase from .helper import unittest, PillowTestCase
from PIL.GimpPaletteFile import GimpPaletteFile from PIL.GimpPaletteFile import GimpPaletteFile

View File

@ -1,4 +1,4 @@
from helper import unittest, PillowTestCase, hopper from .helper import unittest, PillowTestCase, hopper
from PIL import GribStubImagePlugin, Image from PIL import GribStubImagePlugin, Image

View File

@ -1,4 +1,4 @@
from helper import unittest, PillowTestCase from .helper import unittest, PillowTestCase
from PIL import Hdf5StubImagePlugin, Image from PIL import Hdf5StubImagePlugin, Image

View File

@ -1,4 +1,4 @@
from helper import unittest, PillowTestCase from .helper import unittest, PillowTestCase
from PIL import Image, IcnsImagePlugin from PIL import Image, IcnsImagePlugin

View File

@ -1,4 +1,4 @@
from helper import unittest, PillowTestCase, hopper from .helper import unittest, PillowTestCase, hopper
import io import io
from PIL import Image, IcoImagePlugin from PIL import Image, IcoImagePlugin

View File

@ -1,4 +1,4 @@
from helper import unittest, PillowTestCase, hopper from .helper import unittest, PillowTestCase, hopper
from PIL import Image, ImImagePlugin from PIL import Image, ImImagePlugin

View File

@ -1,4 +1,4 @@
from helper import unittest, PillowTestCase, hopper from .helper import unittest, PillowTestCase, hopper
from PIL import Image, IptcImagePlugin from PIL import Image, IptcImagePlugin

View File

@ -1,5 +1,5 @@
from helper import unittest, PillowTestCase, hopper from .helper import unittest, PillowTestCase, hopper
from helper import djpeg_available, cjpeg_available from .helper import djpeg_available, cjpeg_available
from io import BytesIO from io import BytesIO
import os import os

View File

@ -1,4 +1,4 @@
from helper import unittest, PillowTestCase from .helper import unittest, PillowTestCase
from PIL import Image, Jpeg2KImagePlugin from PIL import Image, Jpeg2KImagePlugin
from io import BytesIO from io import BytesIO

View File

@ -1,5 +1,5 @@
from __future__ import print_function from __future__ import print_function
from helper import unittest, PillowTestCase, hopper from .helper import unittest, PillowTestCase, hopper
from PIL import features from PIL import features
from PIL._util import py3 from PIL._util import py3

View File

@ -1,8 +1,8 @@
from helper import unittest from .helper import unittest
from PIL import Image from PIL import Image
from test_file_libtiff import LibTiffTestCase from .test_file_libtiff import LibTiffTestCase
class TestFileLibTiffSmall(LibTiffTestCase): class TestFileLibTiffSmall(LibTiffTestCase):

View File

@ -1,4 +1,4 @@
from helper import unittest, PillowTestCase from .helper import unittest, PillowTestCase
from PIL import Image, McIdasImagePlugin from PIL import Image, McIdasImagePlugin

View File

@ -1,4 +1,4 @@
from helper import unittest, PillowTestCase, hopper from .helper import unittest, PillowTestCase, hopper
from PIL import Image, ImagePalette, features from PIL import Image, ImagePalette, features

View File

@ -1,4 +1,4 @@
from helper import unittest, PillowTestCase from .helper import unittest, PillowTestCase
from io import BytesIO from io import BytesIO
from PIL import Image from PIL import Image

View File

@ -1,4 +1,4 @@
from helper import unittest, PillowTestCase, hopper from .helper import unittest, PillowTestCase, hopper
from PIL import Image, MspImagePlugin from PIL import Image, MspImagePlugin

View File

@ -1,4 +1,4 @@
from helper import unittest, PillowTestCase, hopper, imagemagick_available from .helper import unittest, PillowTestCase, hopper, imagemagick_available
import os.path import os.path

View File

@ -1,4 +1,4 @@
from helper import unittest, PillowTestCase from .helper import unittest, PillowTestCase
from PIL import Image from PIL import Image

View File

@ -1,4 +1,4 @@
from helper import unittest, PillowTestCase, hopper from .helper import unittest, PillowTestCase, hopper
from PIL import Image, ImageFile, PcxImagePlugin from PIL import Image, ImageFile, PcxImagePlugin

View File

@ -1,4 +1,4 @@
from helper import unittest, PillowTestCase, hopper from .helper import unittest, PillowTestCase, hopper
from PIL import Image, PdfParser from PIL import Image, PdfParser
import io import io
import os import os

View File

@ -1,4 +1,4 @@
from helper import hopper, unittest, PillowTestCase from .helper import hopper, unittest, PillowTestCase
from PIL import Image, PixarImagePlugin from PIL import Image, PixarImagePlugin

View File

@ -1,4 +1,4 @@
from helper import unittest, PillowTestCase, PillowLeakTestCase, hopper from .helper import unittest, PillowTestCase, PillowLeakTestCase, hopper
from PIL import Image, ImageFile, PngImagePlugin from PIL import Image, ImageFile, PngImagePlugin
from PIL._util import py3 from PIL._util import py3

View File

@ -1,4 +1,4 @@
from helper import unittest, PillowTestCase from .helper import unittest, PillowTestCase
from PIL import Image from PIL import Image

View File

@ -1,4 +1,4 @@
from helper import hopper, unittest, PillowTestCase from .helper import hopper, unittest, PillowTestCase
from PIL import Image, PsdImagePlugin from PIL import Image, PsdImagePlugin

View File

@ -1,4 +1,4 @@
from helper import unittest, PillowTestCase, hopper from .helper import unittest, PillowTestCase, hopper
from PIL import Image, SgiImagePlugin from PIL import Image, SgiImagePlugin

View File

@ -1,4 +1,4 @@
from helper import unittest, PillowTestCase, hopper from .helper import unittest, PillowTestCase, hopper
from PIL import Image from PIL import Image
from PIL import ImageSequence from PIL import ImageSequence

View File

@ -1,4 +1,4 @@
from helper import unittest, PillowTestCase, hopper from .helper import unittest, PillowTestCase, hopper
from PIL import Image, SunImagePlugin from PIL import Image, SunImagePlugin

View File

@ -1,4 +1,4 @@
from helper import unittest, PillowTestCase from .helper import unittest, PillowTestCase
from PIL import Image, TarIO from PIL import Image, TarIO

View File

@ -2,7 +2,7 @@ import os
from glob import glob from glob import glob
from itertools import product from itertools import product
from helper import unittest, PillowTestCase from .helper import unittest, PillowTestCase
from PIL import Image from PIL import Image

View File

@ -2,7 +2,7 @@ import logging
from io import BytesIO from io import BytesIO
import sys import sys
from helper import unittest, PillowTestCase, hopper from .helper import unittest, PillowTestCase, hopper
from PIL import Image, TiffImagePlugin from PIL import Image, TiffImagePlugin
from PIL._util import py3 from PIL._util import py3

View File

@ -1,7 +1,7 @@
import io import io
import struct import struct
from helper import unittest, PillowTestCase, hopper from .helper import unittest, PillowTestCase, hopper
from PIL import Image, TiffImagePlugin, TiffTags from PIL import Image, TiffImagePlugin, TiffTags
from PIL.TiffImagePlugin import _limit_rational, IFDRational from PIL.TiffImagePlugin import _limit_rational, IFDRational

View File

@ -1,4 +1,4 @@
from helper import unittest, PillowTestCase from .helper import unittest, PillowTestCase
from PIL import WalImageFile from PIL import WalImageFile

View File

@ -1,4 +1,4 @@
from helper import unittest, PillowTestCase, hopper from .helper import unittest, PillowTestCase, hopper
from PIL import Image, WebPImagePlugin from PIL import Image, WebPImagePlugin

View File

@ -1,4 +1,4 @@
from helper import unittest, PillowTestCase, hopper from .helper import unittest, PillowTestCase, hopper
from PIL import Image from PIL import Image

View File

@ -1,4 +1,4 @@
from helper import unittest, PillowTestCase from .helper import unittest, PillowTestCase
from PIL import Image from PIL import Image

View File

@ -1,4 +1,4 @@
from helper import unittest, PillowTestCase, hopper from .helper import unittest, PillowTestCase, hopper
from PIL import Image from PIL import Image

View File

@ -1,4 +1,4 @@
from helper import unittest, PillowTestCase from .helper import unittest, PillowTestCase
from PIL import Image from PIL import Image

View File

@ -1,4 +1,4 @@
from helper import unittest, PillowTestCase, hopper from .helper import unittest, PillowTestCase, hopper
from PIL import Image from PIL import Image
from PIL import WmfImagePlugin from PIL import WmfImagePlugin

View File

@ -1,4 +1,4 @@
from helper import unittest, PillowTestCase from .helper import unittest, PillowTestCase
from PIL import Image from PIL import Image

View File

@ -1,4 +1,4 @@
from helper import unittest, PillowTestCase, hopper from .helper import unittest, PillowTestCase, hopper
from PIL import Image, XpmImagePlugin from PIL import Image, XpmImagePlugin

View File

@ -1,4 +1,4 @@
from helper import hopper, unittest, PillowTestCase from .helper import hopper, unittest, PillowTestCase
from PIL import Image, XVThumbImagePlugin from PIL import Image, XVThumbImagePlugin

View File

@ -1,4 +1,4 @@
from helper import unittest, PillowTestCase from .helper import unittest, PillowTestCase
from PIL import FontFile, BdfFontFile from PIL import FontFile, BdfFontFile

View File

@ -1,5 +1,5 @@
from __future__ import division from __future__ import division
from helper import unittest, PillowLeakTestCase from .helper import unittest, PillowLeakTestCase
import sys import sys
from PIL import Image, features, ImageDraw, ImageFont from PIL import Image, features, ImageDraw, ImageFont

View File

@ -1,4 +1,4 @@
from helper import unittest, PillowTestCase from .helper import unittest, PillowTestCase
from PIL import Image, FontFile, PcfFontFile from PIL import Image, FontFile, PcfFontFile
from PIL import ImageFont, ImageDraw from PIL import ImageFont, ImageDraw

View File

@ -1,4 +1,4 @@
from helper import unittest, PillowTestCase, hopper from .helper import unittest, PillowTestCase, hopper
from PIL import Image from PIL import Image
from PIL._util import py3 from PIL._util import py3

View File

@ -1,4 +1,4 @@
from helper import unittest, PillowTestCase from .helper import unittest, PillowTestCase
from PIL import Image from PIL import Image

View File

@ -1,4 +1,4 @@
from helper import unittest, PillowTestCase, hopper from .helper import unittest, PillowTestCase, hopper
from PIL import Image from PIL import Image
from PIL._util import py3 from PIL._util import py3

View File

@ -1,4 +1,4 @@
from helper import unittest, PillowTestCase, hopper, on_appveyor from .helper import unittest, PillowTestCase, hopper, on_appveyor
from PIL import Image from PIL import Image
import sys import sys

View File

@ -1,4 +1,4 @@
from helper import unittest, PillowTestCase, hopper from .helper import unittest, PillowTestCase, hopper
from PIL import Image from PIL import Image

View File

@ -1,4 +1,4 @@
from helper import unittest, PillowTestCase, hopper from .helper import unittest, PillowTestCase, hopper
from PIL import Image from PIL import Image

View File

@ -1,4 +1,4 @@
from helper import unittest, PillowTestCase, hopper from .helper import unittest, PillowTestCase, hopper
from PIL import Image from PIL import Image

View File

@ -1,4 +1,4 @@
from helper import unittest, PillowTestCase, hopper from .helper import unittest, PillowTestCase, hopper
from PIL import Image from PIL import Image

View File

@ -1,4 +1,4 @@
from helper import unittest, PillowTestCase, fromstring, tostring from .helper import unittest, PillowTestCase, fromstring, tostring
from PIL import Image from PIL import Image

View File

@ -1,4 +1,4 @@
from helper import unittest, PillowTestCase, hopper from .helper import unittest, PillowTestCase, hopper
from PIL import Image, ImageFilter from PIL import Image, ImageFilter

View File

@ -1,4 +1,4 @@
from helper import unittest, PillowTestCase, hopper from .helper import unittest, PillowTestCase, hopper
from PIL import Image from PIL import Image

View File

@ -1,5 +1,5 @@
from helper import unittest, PillowTestCase, hopper from .helper import unittest, PillowTestCase, hopper
from test_imageqt import PillowQtTestCase from .test_imageqt import PillowQtTestCase
from PIL import ImageQt, Image from PIL import ImageQt, Image

View File

@ -1,4 +1,4 @@
from helper import unittest, PillowTestCase from .helper import unittest, PillowTestCase
from PIL import Image from PIL import Image

View File

@ -1,4 +1,4 @@
from helper import unittest, PillowTestCase, hopper from .helper import unittest, PillowTestCase, hopper
from PIL import Image from PIL import Image

View File

@ -1,4 +1,4 @@
from helper import unittest, PillowTestCase, hopper from .helper import unittest, PillowTestCase, hopper
class TestImageGetColors(PillowTestCase): class TestImageGetColors(PillowTestCase):

View File

@ -1,4 +1,4 @@
from helper import unittest, PillowTestCase, hopper from .helper import unittest, PillowTestCase, hopper
class TestImageGetData(PillowTestCase): class TestImageGetData(PillowTestCase):

View File

@ -1,5 +1,5 @@
from PIL import Image from PIL import Image
from helper import unittest, PillowTestCase, hopper from .helper import unittest, PillowTestCase, hopper
class TestImageGetExtrema(PillowTestCase): class TestImageGetExtrema(PillowTestCase):

View File

@ -1,4 +1,4 @@
from helper import unittest, PillowTestCase, hopper from .helper import unittest, PillowTestCase, hopper
from PIL._util import py3 from PIL._util import py3

View File

@ -1,4 +1,4 @@
from helper import unittest, PillowTestCase, hopper from .helper import unittest, PillowTestCase, hopper
class TestImageGetPalette(PillowTestCase): class TestImageGetPalette(PillowTestCase):

View File

@ -1,4 +1,4 @@
from helper import unittest, PillowTestCase, hopper from .helper import unittest, PillowTestCase, hopper
from PIL import Image from PIL import Image

View File

@ -1,4 +1,4 @@
from helper import unittest, PillowTestCase, hopper from .helper import unittest, PillowTestCase, hopper
class TestImageHistogram(PillowTestCase): class TestImageHistogram(PillowTestCase):

Some files were not shown because too many files have changed in this diff Show More