Pillow/Tests
Will Badart adae7ecc6a
_util.isPath returns True for pathlib.Path objects
Now, for functions which accept either a path or file object, the
predicate will pass on Paths and not attempt to call .read on them
before opening.

The pathlib module was added in 3.4 but os.path functions did not start
accepting path-like objects until 3.6, so that is the version after
which this implementation is defined.

Added a unit test to make sure isPath accepts Path objects. The unit
test is skipped if python version is not 3.6 or later.
2019-01-28 12:19:21 -05: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
32bit_segfault_check.py Set executable flag on scripts with shebang line 2017-03-31 19:43:19 +11:00
bench_cffi_access.py remove end of file banner from all files 2016-07-10 14:11:28 +03:00
bench_get.py Flake8 blank line fixes 2018-03-04 21:36:33 +11:00
check_fli_overflow.py Health fixes 2016-04-01 21:49:30 +11:00
check_icns_dos.py Added py3 variable to _util 2018-04-20 09:19:13 +10:00
check_imaging_leaks.py Line too long 2018-09-27 20:35:00 +10:00
check_j2k_dos.py Added py3 variable to _util 2018-04-20 09:19:13 +10:00
check_j2k_leaks.py Replaced MacOS with macOS 2018-03-19 19:38:17 +11:00
check_j2k_overflow.py Flake8 blank line fixes 2018-03-04 21:36:33 +11:00
check_jpeg_leaks.py Remove additional references to nose tests 2018-09-15 12:29:11 -07:00
check_large_memory_numpy.py remove end of file banner from all files 2016-07-10 14:11:28 +03:00
check_large_memory.py Remove redundant parentheses 2018-10-24 22:29:56 +03:00
check_libtiff_segfault.py Replace try/except/fail pattern with TestCase.assertRaises() 2016-11-06 13:43:09 -08:00
check_png_dos.py Corrected TypeError in Python 3 2018-11-13 21:45:52 +11: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 No need to run coverage on dev machines 2017-12-28 14:49:47 +00:00
test_000_sanity.py Remove unused local variables 2018-10-24 22:29:01 +03:00
test_binary.py Flake8 blank line fixes 2018-03-04 21:36:33 +11:00
test_bmp_reference.py Close exclusive fp on open exception 2018-11-09 11:35:08 +11:00
test_box_blur.py ImageOps.box_blur is deprecated, use ImageFilter.BoxBlur instead 2018-04-14 21:54:40 +03:00
test_color_lut.py Add assert for previously unused 'lut' variable 2018-10-24 22:29:01 +03:00
test_core_resources.py Added __main__ code 2018-11-12 19:54:26 +11:00
test_decompression_bomb.py flake8 2018-09-26 14:09:31 +03:00
test_features.py More specific exception clause 2018-10-24 22:29:01 +03:00
test_file_blp.py blp: Remove images with unclear licenses 2018-03-12 09:48:13 +02:00
test_file_bmp.py Changed format of lambda calls 2017-09-01 21:05:40 +10:00
test_file_bufrstub.py Changed format of lambda calls 2017-09-01 21:05:40 +10:00
test_file_container.py Test ContainerIO for correctness 2017-03-05 00:46:30 +02:00
test_file_cur.py Close fp before replacing 2018-11-13 22:24:59 +11:00
test_file_dcx.py Resolve __fp when closing and deleting 2018-11-17 21:56:06 +11:00
test_file_dds.py Flake8 blank line fixes 2018-03-04 21:36:33 +11:00
test_file_eps.py Allow EPS tests that do not require Ghostscript 2018-12-30 20:50:09 +11:00
test_file_fitsstub.py Changed format of lambda calls 2017-09-01 21:05:40 +10:00
test_file_fli.py Merge pull request #3261 from radarhere/fp 2018-12-13 21:09:23 +02:00
test_file_fpx.py Allow the olefile dependency to be optional 2017-10-04 06:54:34 -07:00
test_file_ftex.py Flake8 blank line fixes 2018-03-04 21:36:33 +11:00
test_file_gbr.py Flake8 blank line fixes 2018-03-04 21:36:33 +11:00
test_file_gd.py Removed unused imports 2018-09-27 20:31:01 +10:00
test_file_gif.py Merge pull request #3187 from radarhere/encoderinfo 2018-12-26 12:56:50 +02:00
test_file_gimpgradient.py remove end of file banner from all files 2016-07-10 14:11:28 +03:00
test_file_gimppalette.py Changed format of lambda calls 2017-09-01 21:05:40 +10:00
test_file_gribstub.py Changed format of lambda calls 2017-09-01 21:05:40 +10:00
test_file_hdf5stub.py Changed format of lambda calls 2017-09-01 21:05:40 +10:00
test_file_icns.py Close exclusive fp before discarding 2018-11-13 22:13:55 +11:00
test_file_ico.py Use set literal 2018-10-24 22:29:01 +03:00
test_file_im.py Resolve __fp when closing and deleting 2018-11-17 21:56:06 +11:00
test_file_iptc.py Added tests 2017-03-03 19:45:55 +11:00
test_file_jpeg.py Avoid catching unexpected exceptions in tests 2018-09-04 19:43:20 -07:00
test_file_jpeg2k.py Detect whether mimetype is image/jp2 or image/jpx 2019-01-02 15:39:39 +11:00
test_file_libtiff_small.py remove end of file banner from all files 2016-07-10 14:11:28 +03:00
test_file_libtiff.py Python del is a statement not a function 2019-01-12 18:28:35 -08:00
test_file_mcidas.py Changed format of lambda calls 2017-09-01 21:05:40 +10:00
test_file_mic.py These tests/features now require libtiff 2017-12-20 12:22:28 +00:00
test_file_mpo.py Resolve __fp when closing and deleting 2018-11-17 21:56:06 +11:00
test_file_msp.py Changed format of lambda calls 2017-09-01 21:05:40 +10:00
test_file_palm.py Changed format of lambda calls 2017-09-01 21:05:40 +10:00
test_file_pcd.py Health fixes 2016-04-01 21:49:30 +11:00
test_file_pcx.py Changed format of lambda calls 2017-09-01 21:05:40 +10:00
test_file_pdf.py Added PDF creation and modification date info 2018-08-25 00:58:49 +10:00
test_file_pixar.py Added ImageFile get_format_mimetype method 2018-06-30 21:08:41 +10:00
test_file_png.py Merge pull request #3532 from radarhere/png_load_end_idat 2019-01-05 12:08:58 +02:00
test_file_ppm.py Changed format of lambda calls 2017-09-01 21:05:40 +10:00
test_file_psd.py Added _min_frame property 2017-09-30 13:33:13 +10:00
test_file_sgi.py If SGI image is RGB mode, then apply image/rgb mimetype 2019-01-02 14:13:37 +11:00
test_file_spider.py Resolve __fp when closing and deleting 2018-11-17 21:56:06 +11:00
test_file_sun.py Flake8 blank line fixes 2018-03-04 21:36:33 +11:00
test_file_tar.py flake8: F841 local variable is assigned to but never used 2018-11-11 19:01:10 +02:00
test_file_tga.py Trim id_section if it is greater than 255 characters 2018-09-08 08:26:32 +10:00
test_file_tiff_metadata.py Changed if to elif 2018-11-12 06:14:04 +11:00
test_file_tiff.py Only close __fp if not fp 2019-01-04 12:29:23 +11:00
test_file_wal.py Basic WAL test 2018-01-29 17:18:06 +02:00
test_file_webp_alpha.py Simplify test skipping 2018-10-24 22:29:01 +03:00
test_file_webp_animated.py Continuation line under-indented for visual indent 2018-07-02 19:21:44 +10:00
test_file_webp_lossless.py Remove redundant parentheses 2018-10-24 22:29:56 +03:00
test_file_webp_metadata.py - flake8 formatting fixes 2017-10-01 15:23:18 -07:00
test_file_webp.py Change color table index background to tuple when saving 2018-11-20 19:50:14 +11:00
test_file_wmf.py Changed format of lambda calls 2017-09-01 21:05:40 +10:00
test_file_xbm.py remove end of file banner from all files 2016-07-10 14:11:28 +03:00
test_file_xpm.py Changed format of lambda calls 2017-09-01 21:05:40 +10:00
test_file_xvthumb.py Changed format of lambda calls 2017-09-01 21:05:40 +10:00
test_font_bdf.py Changed format of lambda calls 2017-09-01 21:05:40 +10:00
test_font_leaks.py Line too long 2018-07-02 19:26:02 +10:00
test_font_pcf.py Merge pull request #3105 from radarhere/py3 2018-04-22 18:37:33 +03:00
test_format_hsv.py Remove redundant parentheses 2018-10-21 17:05:40 +03:00
test_format_lab.py remove end of file banner from all files 2016-07-10 14:11:28 +03:00
test_image_access.py Drop support for EOL Python 3.4 2019-01-24 23:33:14 +02:00
test_image_array.py Line too long 2018-07-02 19:26:02 +10:00
test_image_convert.py Use more specific assertions 2018-10-24 22:29:01 +03:00
test_image_copy.py Flake8 fixes 2017-04-20 21:14:23 +10:00
test_image_crop.py flake8 2018-09-26 13:58:15 +03:00
test_image_draft.py Flake8 blank line fixes 2018-03-04 21:36:33 +11:00
test_image_filter.py flake8: E127 continuation line over-indented for visual indent 2018-11-11 19:01:11 +02:00
test_image_frombytes.py Added tests 2017-09-01 20:36:51 +10:00
test_image_fromqimage.py remove end of file banner from all files 2016-07-10 14:11:28 +03:00
test_image_getbands.py remove end of file banner from all files 2016-07-10 14:11:28 +03:00
test_image_getbbox.py Changed assert checks to more specific versions 2017-06-03 14:04:54 +10:00
test_image_getcolors.py Changed assert checks to more specific versions 2017-06-03 14:04:54 +10:00
test_image_getdata.py Remove redundant parentheses 2018-10-24 22:29:56 +03:00
test_image_getextrema.py Remove redundant parentheses 2018-10-24 22:29:56 +03:00
test_image_getim.py Added py3 variable to _util 2018-04-20 09:19:13 +10:00
test_image_getpalette.py Changed assert checks to more specific versions 2017-06-03 14:04:54 +10:00
test_image_getprojection.py remove end of file banner from all files 2016-07-10 14:11:28 +03:00
test_image_histogram.py remove end of file banner from all files 2016-07-10 14:11:28 +03:00
test_image_load.py Flake8 blank line fixes 2018-03-04 21:36:33 +11:00
test_image_mode.py remove end of file banner from all files 2016-07-10 14:11:28 +03:00
test_image_paste.py Flake8 fixes 2017-04-20 21:14:23 +10:00
test_image_point.py Changed format of lambda calls 2017-09-01 21:05:40 +10:00
test_image_putalpha.py remove end of file banner from all files 2016-07-10 14:11:28 +03:00
test_image_putdata.py Flake8 blank line fixes 2018-03-04 21:36:33 +11:00
test_image_putpalette.py Changed format of lambda calls 2017-09-01 21:05:40 +10:00
test_image_quantize.py Changed Exception tests to be more specific 2018-06-12 04:41:31 +10:00
test_image_resample.py Remove redundant parentheses 2018-10-24 22:29:56 +03:00
test_image_resize.py Continuation line under-indented for visual indent 2018-07-02 19:21:44 +10:00
test_image_rotate.py Missing whitespace 2018-09-27 19:43:39 +10:00
test_image_split.py remove end of file banner from all files 2016-07-10 14:11:28 +03:00
test_image_thumbnail.py remove end of file banner from all files 2016-07-10 14:11:28 +03:00
test_image_tobitmap.py Removed duplicate line 2018-01-27 10:09:51 +11:00
test_image_tobytes.py Flake8 blank line fixes 2018-03-04 21:36:33 +11:00
test_image_transform.py flake8: F841 local variable is assigned to but never used 2018-11-11 19:01:10 +02:00
test_image_transpose.py tests for transverse, add to docs 2017-09-11 23:00:35 +03:00
test_image.py flake8: E711 comparison to None should be 'if cond is None:' 2018-11-11 19:01:10 +02:00
test_imagechops.py Added support to floodfill for non-RGB colors 2018-09-26 22:22:17 +10:00
test_imagecms.py flake8: E501 line too long 2018-11-11 19:01:11 +02:00
test_imagecolor.py Line too long 2018-07-02 19:26:02 +10:00
test_imagedraw.py Remove redundant parentheses 2018-10-24 22:29:56 +03:00
test_imagedraw2.py Test ImageDraw2.ellipse 2018-05-31 15:11:50 +03:00
test_imageenhance.py Line too long 2018-07-02 19:26:02 +10:00
test_imagefile.py Remove redundant parentheses 2018-10-24 22:29:56 +03:00
test_imagefont_bitmap.py Line too long 2018-07-02 19:26:02 +10:00
test_imagefont.py Convert assert into exception 2018-08-25 19:06:11 +03:00
test_imagefontctl.py Line too long 2018-07-02 19:26:02 +10:00
test_imagegrab.py Do not play sound when running screencapture command 2018-11-08 06:05:45 +11:00
test_imagemath.py noqa a pair of ambiguous variable names 2018-12-04 23:25:28 +02:00
test_imagemorph.py Line too long 2018-07-02 19:26:02 +10:00
test_imageops_usm.py Remove deprecated ImageOps functions 2019-01-19 20:00:55 +02:00
test_imageops.py Missing whitespace 2018-09-27 19:43:39 +10:00
test_imagepalette.py Continuation line under-indented for visual indent 2018-07-02 19:21:44 +10:00
test_imagepath.py Added py3 variable to _util 2018-04-20 09:19:13 +10:00
test_imageqt.py Added PySide2 2018-08-25 00:51:50 +10:00
test_imagesequence.py Flake8 blank line fixes 2018-03-04 21:36:33 +11:00
test_imageshow.py Added UnixViewer get_command 2018-11-12 19:33:57 +11:00
test_imagestat.py Changed format of lambda calls 2017-09-01 21:05:40 +10:00
test_imagetk.py Remove redundant parentheses 2018-10-24 22:29:56 +03:00
test_imagewin_pointers.py Clean up commented out debug print statements 2018-09-04 20:02:42 -07:00
test_imagewin.py Remove functions deprecated and warning since 2.0 (15 Mar 2013) and raising exceptions since 3.0 (1 Oct 2015) 2017-05-27 21:52:43 +03:00
test_lib_image.py Changed format of lambda calls 2017-09-01 21:05:40 +10:00
test_lib_pack.py Remove redundant parentheses 2018-10-24 22:29:56 +03:00
test_locale.py Do not use bare except 2018-07-02 19:21:44 +10:00
test_map.py Line too long 2018-07-02 19:26:02 +10:00
test_mode_i16.py Revert little-endian byte order for "I" and "F" rawmodes 2017-08-28 19:02:15 +03:00
test_numpy.py Clean up commented out debug print statements 2018-09-04 20:02:42 -07:00
test_pdfparser.py Merge pull request #3274 from radarhere/pdf 2018-09-29 17:43:05 +03:00
test_pickle.py Flake8 blank line fixes 2018-03-04 21:36:33 +11:00
test_psdraw.py Added anchor to readthedocs URL 2017-02-11 12:47:10 +11:00
test_pyroma.py Simplify test skipping 2018-10-24 22:29:01 +03:00
test_qt_image_fromqpixmap.py Removed unnecessary setUp calls 2018-08-25 00:52:14 +10:00
test_qt_image_toqimage.py flake8: F841 local variable is assigned to but never used 2018-11-11 19:01:10 +02:00
test_qt_image_toqpixmap.py Removed unnecessary setUp calls 2018-08-25 00:52:14 +10:00
test_shell_injection.py Replaced MacOS with macOS 2018-03-19 19:38:17 +11:00
test_tiff_ifdrational.py Flake8 blank line fixes 2018-03-04 21:36:33 +11:00
test_uploader.py Flake8 blank line fixes 2018-03-04 21:36:33 +11:00
test_util.py _util.isPath returns True for pathlib.Path objects 2019-01-28 12:19:21 -05:00
test_webp_leaks.py At least two spaces before inline comment 2018-03-04 21:36:33 +11: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
---------

**If Pillow has been built in-place**

To run an individual test::

    python Tests/test_image.py

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

    pytest -vx Tests

Or with coverage::

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

**If Pillow has been installed**

To run an individual test::

    pytest -k Tests/test_image.py

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

    pytest