Pillow/Tests
Jon Dufresne a33939f5c3 Remove unused, open files at top level of tests.
The data read from the file was unused. The files remained opened and
were never explicitly closed.

Fixes some instances of warnings during tests:

"ResourceWarning: unclosed file ..."
2016-11-01 06:34:17 -07:00
..
fonts Testcase added. 2015-01-07 21:38:35 -08:00
icc Corrected filename [ci skip] 2016-05-03 19:23:51 +10:00
images Map.c overflow fixes 2016-10-03 07:27:02 -07:00
32bit_segfault_check.py flake8 2014-08-28 14:44:19 +03: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 fixes 2015-08-25 22:27:18 +10:00
check_fli_overflow.py Health fixes 2016-04-01 21:49:30 +11:00
check_icns_dos.py flake8 2014-08-28 14:44:19 +03:00
check_imaging_leaks.py Various Flake8 fixes 2015-07-03 16:22:56 +10:00
check_j2k_dos.py flake8 2014-08-28 14:44:19 +03:00
check_j2k_leaks.py Removed or commented unused variables 2015-04-24 16:02:38 +10:00
check_j2k_overflow.py flake8 2016-08-04 09:40:12 +03:00
check_jpeg_leaks.py Changed lines to be below 80 characters 2015-12-02 16:41:26 +11: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 end of file banner from all files 2016-07-10 14:11:28 +03:00
check_libtiff_segfault.py Health fixes 2016-04-01 21:49:30 +11:00
check_png_dos.py ignore large text blocks in PNG if LOAD_TRUNCATED_IMAGES is enabled 2016-06-20 17:33:10 +03:00
check_webp_leaks.py Removed or commented unused variables 2015-04-24 16:02:38 +10:00
helper.py improve tests 2016-09-19 03:12:53 +03:00
import_all.py Flake8 fixes 2015-08-25 22:27:18 +10:00
make_hash.py support for La mode 2016-05-26 15:15:08 +03:00
README.rst Removed whitespace from blank lines 2016-09-03 12:23:42 +10:00
test_000_sanity.py remove end of file banner from all files 2016-07-10 14:11:28 +03:00
test_binary.py remove end of file banner from all files 2016-07-10 14:11:28 +03:00
test_bmp_reference.py remove end of file banner from all files 2016-07-10 14:11:28 +03:00
test_box_blur.py remove end of file banner from all files 2016-07-10 14:11:28 +03:00
test_decompression_bomb.py remove end of file banner from all files 2016-07-10 14:11:28 +03:00
test_features.py remove end of file banner from all files 2016-07-10 14:11:28 +03:00
test_file_bmp.py flake8 2016-08-04 09:40:12 +03:00
test_file_bufrstub.py remove end of file banner from all files 2016-07-10 14:11:28 +03:00
test_file_cur.py remove end of file banner from all files 2016-07-10 14:11:28 +03:00
test_file_dcx.py remove end of file banner from all files 2016-07-10 14:11:28 +03:00
test_file_dds.py Add support for BC7 to DdsImagePlugin 2016-08-26 02:26:03 -05:00
test_file_eps.py Flake8 fixes 2016-09-03 12:17:22 +10:00
test_file_fitsstub.py remove end of file banner from all files 2016-07-10 14:11:28 +03:00
test_file_fli.py Remove unused, open files at top level of tests. 2016-11-01 06:34:17 -07:00
test_file_fpx.py remove end of file banner from all files 2016-07-10 14:11:28 +03:00
test_file_ftex.py Move DDS decoders to C 2016-08-25 19:27:48 -05:00
test_file_gbr.py remove end of file banner from all files 2016-07-10 14:11:28 +03:00
test_file_gif.py Fix BytesWarning discovered while running tests 2016-10-22 12:35:44 -07: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 remove end of file banner from all files 2016-07-10 14:11:28 +03:00
test_file_gribstub.py remove end of file banner from all files 2016-07-10 14:11:28 +03:00
test_file_hdf5stub.py remove end of file banner from all files 2016-07-10 14:11:28 +03:00
test_file_icns.py Remove unused, open files at top level of tests. 2016-11-01 06:34:17 -07:00
test_file_ico.py Remove unused, open files at top level of tests. 2016-11-01 06:34:17 -07:00
test_file_im.py remove end of file banner from all files 2016-07-10 14:11:28 +03:00
test_file_iptc.py remove end of file banner from all files 2016-07-10 14:11:28 +03:00
test_file_jpeg.py Fix "invalid escape sequence" warning in Python 3.6 2016-09-27 19:26:57 -04:00
test_file_jpeg2k.py Fix "invalid escape sequence" warning in Python 3.6 2016-09-27 19:26:57 -04: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 Tests for issue #1651 2016-09-29 22:29:19 +01:00
test_file_mcidas.py remove end of file banner from all files 2016-07-10 14:11:28 +03:00
test_file_mic.py remove end of file banner from all files 2016-07-10 14:11:28 +03:00
test_file_mpo.py remove end of file banner from all files 2016-07-10 14:11:28 +03:00
test_file_msp.py remove end of file banner from all files 2016-07-10 14:11:28 +03:00
test_file_palm.py remove end of file banner from all files 2016-07-10 14:11:28 +03:00
test_file_pcd.py Health fixes 2016-04-01 21:49:30 +11:00
test_file_pcx.py Revert "temporary disable PCX P mode test due to errors in codec" 2016-08-07 13:48:01 +03:00
test_file_pdf.py remove end of file banner from all files 2016-07-10 14:11:28 +03:00
test_file_png.py Remove unused, open files at top level of tests. 2016-11-01 06:34:17 -07:00
test_file_ppm.py Remove unused, open files at top level of tests. 2016-11-01 06:34:17 -07:00
test_file_psd.py Remove unused, open files at top level of tests. 2016-11-01 06:34:17 -07:00
test_file_sgi.py remove end of file banner from all files 2016-07-10 14:11:28 +03:00
test_file_spider.py remove end of file banner from all files 2016-07-10 14:11:28 +03:00
test_file_sun.py remove end of file banner from all files 2016-07-10 14:11:28 +03:00
test_file_tar.py remove end of file banner from all files 2016-07-10 14:11:28 +03:00
test_file_tga.py Test TGA RLE file 2016-04-21 17:49:35 +03:00
test_file_tiff_metadata.py Merge pull request #2024 from uploadcare/fix-empty-exif-tags 2016-09-29 08:24:44 -07:00
test_file_tiff.py Fix BytesWarning discovered while running tests 2016-10-22 12:35:44 -07:00
test_file_webp_alpha.py remove end of file banner from all files 2016-07-10 14:11:28 +03:00
test_file_webp_lossless.py remove end of file banner from all files 2016-07-10 14:11:28 +03:00
test_file_webp_metadata.py remove end of file banner from all files 2016-07-10 14:11:28 +03:00
test_file_webp.py remove end of file banner from all files 2016-07-10 14:11:28 +03: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 remove end of file banner from all files 2016-07-10 14:11:28 +03:00
test_font_bdf.py remove end of file banner from all files 2016-07-10 14:11:28 +03:00
test_font_pcf.py remove end of file banner from all files 2016-07-10 14:11:28 +03:00
test_format_hsv.py remove end of file banner from all files 2016-07-10 14:11:28 +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 Fixed typos 2016-10-02 21:31:53 +11:00
test_image_array.py Fixed typos 2016-08-31 20:12:07 +10:00
test_image_convert.py remove end of file banner from all files 2016-07-10 14:11:28 +03:00
test_image_copy.py remove end of file banner from all files 2016-07-10 14:11:28 +03:00
test_image_crop.py Make Image.crop an immediate operation, not lazy. Fixes #1077 2016-09-29 13:28:24 -07:00
test_image_draft.py remove end of file banner from all files 2016-07-10 14:11:28 +03:00
test_image_filter.py remove end of file banner from all files 2016-07-10 14:11:28 +03:00
test_image_frombytes.py remove end of file banner from all files 2016-07-10 14:11:28 +03:00
test_image_fromqimage.py remove end of file banner from all files 2016-07-10 14:11:28 +03:00
test_image_fromqpixmap.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 remove end of file banner from all files 2016-07-10 14:11:28 +03:00
test_image_getcolors.py remove end of file banner from all files 2016-07-10 14:11:28 +03:00
test_image_getdata.py Merge branch 'master' into rotation-pixel-center 2016-08-07 13:47:16 +03:00
test_image_getextrema.py remove end of file banner from all files 2016-07-10 14:11:28 +03:00
test_image_getim.py remove end of file banner from all files 2016-07-10 14:11:28 +03:00
test_image_getpalette.py remove end of file banner from all files 2016-07-10 14:11:28 +03: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 remove end of file banner from all files 2016-07-10 14:11:28 +03: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 improve tests 2016-09-19 03:12:53 +03:00
test_image_point.py remove end of file banner from all files 2016-07-10 14:11:28 +03: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 remove end of file banner from all files 2016-07-10 14:11:28 +03:00
test_image_putpalette.py remove end of file banner from all files 2016-07-10 14:11:28 +03:00
test_image_quantize.py remove end of file banner from all files 2016-07-10 14:11:28 +03:00
test_image_resample.py Fix coefficients calculation (#2162) 2016-10-17 01:31:45 -07:00
test_image_resize.py remove end of file banner from all files 2016-07-10 14:11:28 +03:00
test_image_rotate.py Merge pull request #2052 from uploadcare/rotate-loading 2016-08-05 19:35:06 +03: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 remove end of file banner from all files 2016-07-10 14:11:28 +03:00
test_image_tobytes.py remove end of file banner from all files 2016-07-10 14:11:28 +03:00
test_image_toqimage.py remove end of file banner from all files 2016-07-10 14:11:28 +03:00
test_image_toqpixmap.py remove end of file banner from all files 2016-07-10 14:11:28 +03:00
test_image_transform.py Fixed typos 2016-08-31 20:12:07 +10:00
test_image_transpose.py Further health fixes 2015-04-24 18:24:52 +10:00
test_image.py improve test 2016-10-04 03:11:53 +03:00
test_imagechops.py remove end of file banner from all files 2016-07-10 14:11:28 +03:00
test_imagecms.py Merge pull request #2131 from wiredfool/imagecms-segfault 2016-10-03 06:02:39 -07:00
test_imagecolor.py added more case insensitivity tests 2016-09-19 12:12:16 +03:00
test_imagedraw.py remove end of file banner from all files 2016-07-10 14:11:28 +03:00
test_imageenhance.py remove end of file banner from all files 2016-07-10 14:11:28 +03:00
test_imagefile.py remove end of file banner from all files 2016-07-10 14:11:28 +03:00
test_imagefont_bitmap.py Flake8 fixes 2015-12-31 07:27:27 +11:00
test_imagefont.py Fix "invalid escape sequence" warning in Python 3.6 2016-09-27 19:26:57 -04:00
test_imagegrab.py Renamed references to OS X to macOS 2016-09-23 21:12:03 +10:00
test_imagemath.py remove end of file banner from all files 2016-07-10 14:11:28 +03:00
test_imagemorph.py remove end of file banner from all files 2016-07-10 14:11:28 +03:00
test_imageops_usm.py remove end of file banner from all files 2016-07-10 14:11:28 +03:00
test_imageops.py Removed whitespace from blank lines 2016-09-03 12:23:42 +10:00
test_imagepalette.py remove end of file banner from all files 2016-07-10 14:11:28 +03:00
test_imagepath.py flake8 2016-08-04 09:40:12 +03:00
test_imageqt.py remove end of file banner from all files 2016-07-10 14:11:28 +03:00
test_imagesequence.py Force reloading palette when using mmap in ImageFile. 2016-09-29 14:54:25 +02:00
test_imageshow.py remove end of file banner from all files 2016-07-10 14:11:28 +03:00
test_imagestat.py remove end of file banner from all files 2016-07-10 14:11:28 +03:00
test_imagetk.py flake8 2016-08-04 09:40:12 +03:00
test_imagewin_pointers.py flake8 2016-08-04 09:40:12 +03:00
test_imagewin.py remove end of file banner from all files 2016-07-10 14:11:28 +03:00
test_lib_image.py remove end of file banner from all files 2016-07-10 14:11:28 +03:00
test_lib_pack.py Merged BGRa test into Tests/test_lib_pack.py 2016-08-08 00:07:08 +02:00
test_locale.py remove end of file banner from all files 2016-07-10 14:11:28 +03:00
test_map.py Vulnerable map function is not called on windows 2016-10-03 07:42:48 -07:00
test_mode_i16.py remove end of file banner from all files 2016-07-10 14:11:28 +03:00
test_numpy.py Flake8 fixes 2016-09-03 12:17:22 +10:00
test_olefileio.py remove end of file banner from all files 2016-07-10 14:11:28 +03:00
test_pickle.py remove end of file banner from all files 2016-07-10 14:11:28 +03:00
test_psdraw.py remove end of file banner from all files 2016-07-10 14:11:28 +03:00
test_pyroma.py remove end of file banner from all files 2016-07-10 14:11:28 +03:00
test_scipy.py Clarified comment 2015-12-25 12:02:18 +11:00
test_shell_injection.py remove end of file banner from all files 2016-07-10 14:11:28 +03:00
test_tiff_ifdrational.py flake8 2016-08-04 09:40:12 +03:00
test_util.py remove end of file banner from all files 2016-07-10 14:11:28 +03:00
threaded_save.py Added missing future print imports and removed unnecessary imports 2015-05-23 20:28:41 +10:00
versions.py Added missing future print imports and removed unnecessary imports 2015-05-23 20:28:41 +10: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 coverage nose

If you're using Python 2.6, there's one additional dependency::

    pip install unittest2

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::

    nosetests -vx Tests/test_*.py

Or with coverage::

    coverage run --append --include=PIL/* -m nose -vx Tests/test_*.py
    coverage report
    coverage html
    open htmlcov/index.html

**If Pillow has been installed**

To run an individual test::

    ./test-installed.py Tests/test_image.py

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

    ./test-installed.py