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.

View File

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

View File

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

View File

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

View File

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

View File

@ -1,5 +1,5 @@
from PIL import Image
from helper import unittest, PillowTestCase
from .helper import unittest, 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
import sys

View File

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

View File

@ -1,6 +1,6 @@
import sys
from helper import unittest, PillowTestCase
from .helper import unittest, PillowTestCase
# 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
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 io import BytesIO
import zlib

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -2,7 +2,7 @@ from __future__ import division, print_function
import sys
from helper import unittest, PillowTestCase
from .helper import unittest, PillowTestCase
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

View File

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

View File

@ -1,6 +1,6 @@
from PIL import Image
from helper import PillowTestCase, unittest
from .helper import PillowTestCase, unittest
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
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

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 ContainerIO

View File

@ -1,4 +1,4 @@
from helper import unittest, PillowTestCase
from .helper import unittest, PillowTestCase
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

View File

@ -1,6 +1,6 @@
from io import BytesIO
from helper import unittest, PillowTestCase
from .helper import unittest, PillowTestCase
from PIL import Image, DdsImagePlugin
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
import io

View File

@ -1,4 +1,4 @@
from helper import unittest, PillowTestCase
from .helper import unittest, PillowTestCase
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

View File

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

View File

@ -1,4 +1,4 @@
from helper import unittest, PillowTestCase
from .helper import unittest, PillowTestCase
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

View File

@ -1,4 +1,4 @@
from helper import unittest, PillowTestCase
from .helper import unittest, PillowTestCase
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

View File

@ -1,4 +1,4 @@
from helper import unittest, PillowTestCase
from .helper import unittest, PillowTestCase
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

View File

@ -1,4 +1,4 @@
from helper import unittest, PillowTestCase, hopper
from .helper import unittest, PillowTestCase, hopper
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

View File

@ -1,4 +1,4 @@
from helper import unittest, PillowTestCase
from .helper import unittest, PillowTestCase
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
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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,8 +1,8 @@
from helper import unittest
from .helper import unittest
from PIL import Image
from test_file_libtiff import LibTiffTestCase
from .test_file_libtiff import 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

View File

@ -1,4 +1,4 @@
from helper import unittest, PillowTestCase, hopper
from .helper import unittest, PillowTestCase, hopper
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 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

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

View File

@ -1,4 +1,4 @@
from helper import unittest, PillowTestCase
from .helper import unittest, PillowTestCase
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

View File

@ -1,4 +1,4 @@
from helper import unittest, PillowTestCase, hopper
from .helper import unittest, PillowTestCase, hopper
from PIL import Image, PdfParser
import io
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

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._util import py3

View File

@ -1,4 +1,4 @@
from helper import unittest, PillowTestCase
from .helper import unittest, PillowTestCase
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

View File

@ -1,4 +1,4 @@
from helper import unittest, PillowTestCase, hopper
from .helper import unittest, PillowTestCase, hopper
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 ImageSequence

View File

@ -1,4 +1,4 @@
from helper import unittest, PillowTestCase, hopper
from .helper import unittest, PillowTestCase, hopper
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

View File

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

View File

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

View File

@ -1,7 +1,7 @@
import io
import struct
from helper import unittest, PillowTestCase, hopper
from .helper import unittest, PillowTestCase, hopper
from PIL import Image, TiffImagePlugin, TiffTags
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

View File

@ -1,4 +1,4 @@
from helper import unittest, PillowTestCase, hopper
from .helper import unittest, PillowTestCase, hopper
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

View File

@ -1,4 +1,4 @@
from helper import unittest, PillowTestCase
from .helper import unittest, PillowTestCase
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

View File

@ -1,4 +1,4 @@
from helper import unittest, PillowTestCase
from .helper import unittest, PillowTestCase
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 WmfImagePlugin

View File

@ -1,4 +1,4 @@
from helper import unittest, PillowTestCase
from .helper import unittest, PillowTestCase
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

View File

@ -1,4 +1,4 @@
from helper import hopper, unittest, PillowTestCase
from .helper import hopper, unittest, PillowTestCase
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

View File

@ -1,5 +1,5 @@
from __future__ import division
from helper import unittest, PillowLeakTestCase
from .helper import unittest, PillowLeakTestCase
import sys
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 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._util import py3

View File

@ -1,4 +1,4 @@
from helper import unittest, PillowTestCase
from .helper import unittest, PillowTestCase
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._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
import sys

View File

@ -1,4 +1,4 @@
from helper import unittest, PillowTestCase, hopper
from .helper import unittest, PillowTestCase, hopper
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

View File

@ -1,4 +1,4 @@
from helper import unittest, PillowTestCase, hopper
from .helper import unittest, PillowTestCase, hopper
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

View File

@ -1,4 +1,4 @@
from helper import unittest, PillowTestCase, fromstring, tostring
from .helper import unittest, PillowTestCase, fromstring, tostring
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

View File

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

View File

@ -1,5 +1,5 @@
from helper import unittest, PillowTestCase, hopper
from test_imageqt import PillowQtTestCase
from .helper import unittest, PillowTestCase, hopper
from .test_imageqt import PillowQtTestCase
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

View File

@ -1,4 +1,4 @@
from helper import unittest, PillowTestCase, hopper
from .helper import unittest, PillowTestCase, hopper
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):

View File

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

View File

@ -1,5 +1,5 @@
from PIL import Image
from helper import unittest, PillowTestCase, hopper
from .helper import unittest, PillowTestCase, hopper
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

View File

@ -1,4 +1,4 @@
from helper import unittest, PillowTestCase, hopper
from .helper import unittest, PillowTestCase, hopper
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

View File

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

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