Pillow/Tests
Jon Dufresne 4de5477b61 Remove unnecessary unittest.main() boilerplate from test files
With the introduction and use of pytest, it is simple and easy to
execute specific tests in isolation through documented command line
arguments. Either by specifying the module path or through the `-k
EXPRESSION` argument. There is no longer any need to provide the
boilerplate:

    if __name__ == '__main__':
        unittest.main()

To every test file. It is simply noise.

The pattern remains in test files that aren't named with `test_*` as
those files are not discovered and executed by pytest by default.
2019-02-03 10:10:16 -08:00
..
fonts test the accuracy of the font file conversion 2017-11-02 13:07:49 +00:00
icc Corrected filename [ci skip] 2016-05-03 19:23:51 +10:00
images Merge pull request #3540 from radarhere/fp 2019-01-06 12:53:04 +02:00
__init__.py Improve pytest configuration to allow specific tests as CLI args 2019-01-13 09:00:12 -08:00
32bit_segfault_check.py Set executable flag on scripts with shebang line 2017-03-31 19:43:19 +11:00
bench_cffi_access.py Improve pytest configuration to allow specific tests as CLI args 2019-01-13 09:00:12 -08:00
bench_get.py Improve pytest configuration to allow specific tests as CLI args 2019-01-13 09:00:12 -08:00
check_fli_overflow.py Improve pytest configuration to allow specific tests as CLI args 2019-01-13 09:00:12 -08:00
check_icns_dos.py Added py3 variable to _util 2018-04-20 09:19:13 +10:00
check_imaging_leaks.py Improve pytest configuration to allow specific tests as CLI args 2019-01-13 09:00:12 -08:00
check_j2k_dos.py Added py3 variable to _util 2018-04-20 09:19:13 +10:00
check_j2k_leaks.py Improve pytest configuration to allow specific tests as CLI args 2019-01-13 09:00:12 -08:00
check_j2k_overflow.py Improve pytest configuration to allow specific tests as CLI args 2019-01-13 09:00:12 -08:00
check_jpeg_leaks.py Improve pytest configuration to allow specific tests as CLI args 2019-01-13 09:00:12 -08:00
check_large_memory_numpy.py Improve pytest configuration to allow specific tests as CLI args 2019-01-13 09:00:12 -08:00
check_large_memory.py Improve pytest configuration to allow specific tests as CLI args 2019-01-13 09:00:12 -08:00
check_libtiff_segfault.py Improve pytest configuration to allow specific tests as CLI args 2019-01-13 09:00:12 -08:00
check_png_dos.py Improve pytest configuration to allow specific tests as CLI args 2019-01-13 09:00:12 -08:00
createfontdatachunk.py Remove unused 'sys' import 2018-12-04 23:25:28 +02:00
helper.py Revert "Use bare 'raise' to re-raise exceptions" 2019-01-14 21:55:47 +11:00
import_all.py Updated paths for src directory 2017-12-31 07:11:26 +11:00
make_hash.py Clean up commented out debug print statements 2018-09-04 20:02:42 -07:00
README.rst Remove unnecessary unittest.main() boilerplate from test files 2019-02-03 10:10:16 -08:00
test_000_sanity.py Remove unnecessary unittest.main() boilerplate from test files 2019-02-03 10:10:16 -08:00
test_binary.py Remove unnecessary unittest.main() boilerplate from test files 2019-02-03 10:10:16 -08:00
test_bmp_reference.py Remove unnecessary unittest.main() boilerplate from test files 2019-02-03 10:10:16 -08:00
test_box_blur.py Remove unnecessary unittest.main() boilerplate from test files 2019-02-03 10:10:16 -08:00
test_color_lut.py Remove unnecessary unittest.main() boilerplate from test files 2019-02-03 10:10:16 -08:00
test_core_resources.py Remove unnecessary unittest.main() boilerplate from test files 2019-02-03 10:10:16 -08:00
test_decompression_bomb.py Remove unnecessary unittest.main() boilerplate from test files 2019-02-03 10:10:16 -08:00
test_features.py Remove unnecessary unittest.main() boilerplate from test files 2019-02-03 10:10:16 -08:00
test_file_blp.py Remove unnecessary unittest.main() boilerplate from test files 2019-02-03 10:10:16 -08:00
test_file_bmp.py Remove unnecessary unittest.main() boilerplate from test files 2019-02-03 10:10:16 -08:00
test_file_bufrstub.py Remove unnecessary unittest.main() boilerplate from test files 2019-02-03 10:10:16 -08:00
test_file_container.py Remove unnecessary unittest.main() boilerplate from test files 2019-02-03 10:10:16 -08:00
test_file_cur.py Remove unnecessary unittest.main() boilerplate from test files 2019-02-03 10:10:16 -08:00
test_file_dcx.py Remove unnecessary unittest.main() boilerplate from test files 2019-02-03 10:10:16 -08:00
test_file_dds.py Remove unnecessary unittest.main() boilerplate from test files 2019-02-03 10:10:16 -08:00
test_file_eps.py Remove unnecessary unittest.main() boilerplate from test files 2019-02-03 10:10:16 -08:00
test_file_fitsstub.py Remove unnecessary unittest.main() boilerplate from test files 2019-02-03 10:10:16 -08:00
test_file_fli.py Remove unnecessary unittest.main() boilerplate from test files 2019-02-03 10:10:16 -08:00
test_file_fpx.py Remove unnecessary unittest.main() boilerplate from test files 2019-02-03 10:10:16 -08:00
test_file_ftex.py Remove unnecessary unittest.main() boilerplate from test files 2019-02-03 10:10:16 -08:00
test_file_gbr.py Remove unnecessary unittest.main() boilerplate from test files 2019-02-03 10:10:16 -08:00
test_file_gd.py Remove unnecessary unittest.main() boilerplate from test files 2019-02-03 10:10:16 -08:00
test_file_gif.py Remove unnecessary unittest.main() boilerplate from test files 2019-02-03 10:10:16 -08:00
test_file_gimpgradient.py Remove unnecessary unittest.main() boilerplate from test files 2019-02-03 10:10:16 -08:00
test_file_gimppalette.py Remove unnecessary unittest.main() boilerplate from test files 2019-02-03 10:10:16 -08:00
test_file_gribstub.py Remove unnecessary unittest.main() boilerplate from test files 2019-02-03 10:10:16 -08:00
test_file_hdf5stub.py Remove unnecessary unittest.main() boilerplate from test files 2019-02-03 10:10:16 -08:00
test_file_icns.py Remove unnecessary unittest.main() boilerplate from test files 2019-02-03 10:10:16 -08:00
test_file_ico.py Remove unnecessary unittest.main() boilerplate from test files 2019-02-03 10:10:16 -08:00
test_file_im.py Remove unnecessary unittest.main() boilerplate from test files 2019-02-03 10:10:16 -08:00
test_file_iptc.py Remove unnecessary unittest.main() boilerplate from test files 2019-02-03 10:10:16 -08:00
test_file_jpeg.py Remove unnecessary unittest.main() boilerplate from test files 2019-02-03 10:10:16 -08:00
test_file_jpeg2k.py Remove unnecessary unittest.main() boilerplate from test files 2019-02-03 10:10:16 -08:00
test_file_libtiff_small.py Remove unnecessary unittest.main() boilerplate from test files 2019-02-03 10:10:16 -08:00
test_file_libtiff.py Remove unnecessary unittest.main() boilerplate from test files 2019-02-03 10:10:16 -08:00
test_file_mcidas.py Remove unnecessary unittest.main() boilerplate from test files 2019-02-03 10:10:16 -08:00
test_file_mic.py Remove unnecessary unittest.main() boilerplate from test files 2019-02-03 10:10:16 -08:00
test_file_mpo.py Remove unnecessary unittest.main() boilerplate from test files 2019-02-03 10:10:16 -08:00
test_file_msp.py Remove unnecessary unittest.main() boilerplate from test files 2019-02-03 10:10:16 -08:00
test_file_palm.py Remove unnecessary unittest.main() boilerplate from test files 2019-02-03 10:10:16 -08:00
test_file_pcd.py Remove unnecessary unittest.main() boilerplate from test files 2019-02-03 10:10:16 -08:00
test_file_pcx.py Remove unnecessary unittest.main() boilerplate from test files 2019-02-03 10:10:16 -08:00
test_file_pdf.py Remove unnecessary unittest.main() boilerplate from test files 2019-02-03 10:10:16 -08:00
test_file_pixar.py Remove unnecessary unittest.main() boilerplate from test files 2019-02-03 10:10:16 -08:00
test_file_png.py Remove unnecessary unittest.main() boilerplate from test files 2019-02-03 10:10:16 -08:00
test_file_ppm.py Remove unnecessary unittest.main() boilerplate from test files 2019-02-03 10:10:16 -08:00
test_file_psd.py Remove unnecessary unittest.main() boilerplate from test files 2019-02-03 10:10:16 -08:00
test_file_sgi.py Remove unnecessary unittest.main() boilerplate from test files 2019-02-03 10:10:16 -08:00
test_file_spider.py Remove unnecessary unittest.main() boilerplate from test files 2019-02-03 10:10:16 -08:00
test_file_sun.py Remove unnecessary unittest.main() boilerplate from test files 2019-02-03 10:10:16 -08:00
test_file_tar.py Remove unnecessary unittest.main() boilerplate from test files 2019-02-03 10:10:16 -08:00
test_file_tga.py Remove unnecessary unittest.main() boilerplate from test files 2019-02-03 10:10:16 -08:00
test_file_tiff_metadata.py Remove unnecessary unittest.main() boilerplate from test files 2019-02-03 10:10:16 -08:00
test_file_tiff.py Remove unnecessary unittest.main() boilerplate from test files 2019-02-03 10:10:16 -08:00
test_file_wal.py Remove unnecessary unittest.main() boilerplate from test files 2019-02-03 10:10:16 -08:00
test_file_webp_alpha.py Remove unnecessary unittest.main() boilerplate from test files 2019-02-03 10:10:16 -08:00
test_file_webp_animated.py Remove unnecessary unittest.main() boilerplate from test files 2019-02-03 10:10:16 -08:00
test_file_webp_lossless.py Remove unnecessary unittest.main() boilerplate from test files 2019-02-03 10:10:16 -08:00
test_file_webp_metadata.py Remove unnecessary unittest.main() boilerplate from test files 2019-02-03 10:10:16 -08:00
test_file_webp.py Remove unnecessary unittest.main() boilerplate from test files 2019-02-03 10:10:16 -08:00
test_file_wmf.py Remove unnecessary unittest.main() boilerplate from test files 2019-02-03 10:10:16 -08:00
test_file_xbm.py Remove unnecessary unittest.main() boilerplate from test files 2019-02-03 10:10:16 -08:00
test_file_xpm.py Remove unnecessary unittest.main() boilerplate from test files 2019-02-03 10:10:16 -08:00
test_file_xvthumb.py Remove unnecessary unittest.main() boilerplate from test files 2019-02-03 10:10:16 -08:00
test_font_bdf.py Remove unnecessary unittest.main() boilerplate from test files 2019-02-03 10:10:16 -08:00
test_font_leaks.py Remove unnecessary unittest.main() boilerplate from test files 2019-02-03 10:10:16 -08:00
test_font_pcf.py Remove unnecessary unittest.main() boilerplate from test files 2019-02-03 10:10:16 -08:00
test_format_hsv.py Remove unnecessary unittest.main() boilerplate from test files 2019-02-03 10:10:16 -08:00
test_format_lab.py Remove unnecessary unittest.main() boilerplate from test files 2019-02-03 10:10:16 -08:00
test_image_access.py Remove unnecessary unittest.main() boilerplate from test files 2019-02-03 10:10:16 -08:00
test_image_array.py Remove unnecessary unittest.main() boilerplate from test files 2019-02-03 10:10:16 -08:00
test_image_convert.py Remove unnecessary unittest.main() boilerplate from test files 2019-02-03 10:10:16 -08:00
test_image_copy.py Remove unnecessary unittest.main() boilerplate from test files 2019-02-03 10:10:16 -08:00
test_image_crop.py Remove unnecessary unittest.main() boilerplate from test files 2019-02-03 10:10:16 -08:00
test_image_draft.py Remove unnecessary unittest.main() boilerplate from test files 2019-02-03 10:10:16 -08:00
test_image_filter.py Remove unnecessary unittest.main() boilerplate from test files 2019-02-03 10:10:16 -08:00
test_image_frombytes.py Remove unnecessary unittest.main() boilerplate from test files 2019-02-03 10:10:16 -08:00
test_image_fromqimage.py Remove unnecessary unittest.main() boilerplate from test files 2019-02-03 10:10:16 -08:00
test_image_getbands.py Remove unnecessary unittest.main() boilerplate from test files 2019-02-03 10:10:16 -08:00
test_image_getbbox.py Remove unnecessary unittest.main() boilerplate from test files 2019-02-03 10:10:16 -08:00
test_image_getcolors.py Remove unnecessary unittest.main() boilerplate from test files 2019-02-03 10:10:16 -08:00
test_image_getdata.py Remove unnecessary unittest.main() boilerplate from test files 2019-02-03 10:10:16 -08:00
test_image_getextrema.py Remove unnecessary unittest.main() boilerplate from test files 2019-02-03 10:10:16 -08:00
test_image_getim.py Remove unnecessary unittest.main() boilerplate from test files 2019-02-03 10:10:16 -08:00
test_image_getpalette.py Remove unnecessary unittest.main() boilerplate from test files 2019-02-03 10:10:16 -08:00
test_image_getprojection.py Remove unnecessary unittest.main() boilerplate from test files 2019-02-03 10:10:16 -08:00
test_image_histogram.py Remove unnecessary unittest.main() boilerplate from test files 2019-02-03 10:10:16 -08:00
test_image_load.py Remove unnecessary unittest.main() boilerplate from test files 2019-02-03 10:10:16 -08:00
test_image_mode.py Remove unnecessary unittest.main() boilerplate from test files 2019-02-03 10:10:16 -08:00
test_image_paste.py Remove unnecessary unittest.main() boilerplate from test files 2019-02-03 10:10:16 -08:00
test_image_point.py Remove unnecessary unittest.main() boilerplate from test files 2019-02-03 10:10:16 -08:00
test_image_putalpha.py Remove unnecessary unittest.main() boilerplate from test files 2019-02-03 10:10:16 -08:00
test_image_putdata.py Remove unnecessary unittest.main() boilerplate from test files 2019-02-03 10:10:16 -08:00
test_image_putpalette.py Remove unnecessary unittest.main() boilerplate from test files 2019-02-03 10:10:16 -08:00
test_image_quantize.py Remove unnecessary unittest.main() boilerplate from test files 2019-02-03 10:10:16 -08:00
test_image_resample.py Remove unnecessary unittest.main() boilerplate from test files 2019-02-03 10:10:16 -08:00
test_image_resize.py Remove unnecessary unittest.main() boilerplate from test files 2019-02-03 10:10:16 -08:00
test_image_rotate.py Remove unnecessary unittest.main() boilerplate from test files 2019-02-03 10:10:16 -08:00
test_image_split.py Remove unnecessary unittest.main() boilerplate from test files 2019-02-03 10:10:16 -08:00
test_image_thumbnail.py Remove unnecessary unittest.main() boilerplate from test files 2019-02-03 10:10:16 -08:00
test_image_tobitmap.py Remove unnecessary unittest.main() boilerplate from test files 2019-02-03 10:10:16 -08:00
test_image_tobytes.py Remove unnecessary unittest.main() boilerplate from test files 2019-02-03 10:10:16 -08:00
test_image_transform.py Remove unnecessary unittest.main() boilerplate from test files 2019-02-03 10:10:16 -08:00
test_image_transpose.py Remove unnecessary unittest.main() boilerplate from test files 2019-02-03 10:10:16 -08:00
test_image.py Remove unnecessary unittest.main() boilerplate from test files 2019-02-03 10:10:16 -08:00
test_imagechops.py Remove unnecessary unittest.main() boilerplate from test files 2019-02-03 10:10:16 -08:00
test_imagecms.py Remove unnecessary unittest.main() boilerplate from test files 2019-02-03 10:10:16 -08:00
test_imagecolor.py Remove unnecessary unittest.main() boilerplate from test files 2019-02-03 10:10:16 -08:00
test_imagedraw.py Remove unnecessary unittest.main() boilerplate from test files 2019-02-03 10:10:16 -08:00
test_imagedraw2.py Remove unnecessary unittest.main() boilerplate from test files 2019-02-03 10:10:16 -08:00
test_imageenhance.py Remove unnecessary unittest.main() boilerplate from test files 2019-02-03 10:10:16 -08:00
test_imagefile.py Remove unnecessary unittest.main() boilerplate from test files 2019-02-03 10:10:16 -08:00
test_imagefont_bitmap.py Remove unnecessary unittest.main() boilerplate from test files 2019-02-03 10:10:16 -08:00
test_imagefont.py Remove unnecessary unittest.main() boilerplate from test files 2019-02-03 10:10:16 -08:00
test_imagefontctl.py Remove unnecessary unittest.main() boilerplate from test files 2019-02-03 10:10:16 -08:00
test_imagegrab.py Remove unnecessary unittest.main() boilerplate from test files 2019-02-03 10:10:16 -08:00
test_imagemath.py Remove unnecessary unittest.main() boilerplate from test files 2019-02-03 10:10:16 -08:00
test_imagemorph.py Remove unnecessary unittest.main() boilerplate from test files 2019-02-03 10:10:16 -08:00
test_imageops_usm.py Remove unnecessary unittest.main() boilerplate from test files 2019-02-03 10:10:16 -08:00
test_imageops.py Remove unnecessary unittest.main() boilerplate from test files 2019-02-03 10:10:16 -08:00
test_imagepalette.py Remove unnecessary unittest.main() boilerplate from test files 2019-02-03 10:10:16 -08:00
test_imagepath.py Remove unnecessary unittest.main() boilerplate from test files 2019-02-03 10:10:16 -08:00
test_imageqt.py Remove unnecessary unittest.main() boilerplate from test files 2019-02-03 10:10:16 -08:00
test_imagesequence.py Remove unnecessary unittest.main() boilerplate from test files 2019-02-03 10:10:16 -08:00
test_imageshow.py Remove unnecessary unittest.main() boilerplate from test files 2019-02-03 10:10:16 -08:00
test_imagestat.py Remove unnecessary unittest.main() boilerplate from test files 2019-02-03 10:10:16 -08:00
test_imagetk.py Remove unnecessary unittest.main() boilerplate from test files 2019-02-03 10:10:16 -08:00
test_imagewin_pointers.py Remove unnecessary unittest.main() boilerplate from test files 2019-02-03 10:10:16 -08:00
test_imagewin.py Remove unnecessary unittest.main() boilerplate from test files 2019-02-03 10:10:16 -08:00
test_lib_image.py Improve pytest configuration to allow specific tests as CLI args 2019-01-13 09:00:12 -08:00
test_lib_pack.py Remove unnecessary unittest.main() boilerplate from test files 2019-02-03 10:10:16 -08:00
test_locale.py Remove unnecessary unittest.main() boilerplate from test files 2019-02-03 10:10:16 -08:00
test_map.py Remove unnecessary unittest.main() boilerplate from test files 2019-02-03 10:10:16 -08:00
test_mode_i16.py Remove unnecessary unittest.main() boilerplate from test files 2019-02-03 10:10:16 -08:00
test_numpy.py Remove unnecessary unittest.main() boilerplate from test files 2019-02-03 10:10:16 -08:00
test_pdfparser.py Remove unnecessary unittest.main() boilerplate from test files 2019-02-03 10:10:16 -08:00
test_pickle.py Remove unnecessary unittest.main() boilerplate from test files 2019-02-03 10:10:16 -08:00
test_psdraw.py Remove unnecessary unittest.main() boilerplate from test files 2019-02-03 10:10:16 -08:00
test_pyroma.py Remove unnecessary unittest.main() boilerplate from test files 2019-02-03 10:10:16 -08:00
test_qt_image_fromqpixmap.py Remove unnecessary unittest.main() boilerplate from test files 2019-02-03 10:10:16 -08:00
test_qt_image_toqimage.py Remove unnecessary unittest.main() boilerplate from test files 2019-02-03 10:10:16 -08:00
test_qt_image_toqpixmap.py Remove unnecessary unittest.main() boilerplate from test files 2019-02-03 10:10:16 -08:00
test_shell_injection.py Remove unnecessary unittest.main() boilerplate from test files 2019-02-03 10:10:16 -08:00
test_tiff_ifdrational.py Remove unnecessary unittest.main() boilerplate from test files 2019-02-03 10:10:16 -08:00
test_uploader.py Remove unnecessary unittest.main() boilerplate from test files 2019-02-03 10:10:16 -08:00
test_util.py Remove unnecessary unittest.main() boilerplate from test files 2019-02-03 10:10:16 -08:00
test_webp_leaks.py Remove unnecessary unittest.main() boilerplate from test files 2019-02-03 10:10:16 -08:00
threaded_save.py Flake8 blank line fixes 2018-03-04 21:36:33 +11:00
versions.py Do not write custom tags with libtiff < 4 2018-11-12 06:14:04 +11:00

Pillow Tests
============

Test scripts are named ``test_xxx.py`` and use the ``unittest`` module. A base class and helper functions can be found in ``helper.py``.

Dependencies
-----------

Install::

    pip install pytest pytest-cov

Execution
---------

To run an individual test::

    pytest Tests/test_image.py

Or::

    pytest -k test_image.py

Run all the tests from the root of the Pillow source distribution::

    pytest

Or with coverage::

    pytest --cov PIL --cov-report term
    coverage html
    open htmlcov/index.html