From d2069c21ceac23694e35fcb780672c0d5d955092 Mon Sep 17 00:00:00 2001 From: hugovk Date: Thu, 26 Oct 2017 08:20:16 +0300 Subject: [PATCH 01/16] Test testing with pytest --- .travis/install.sh | 4 +++- .travis/script.sh | 3 ++- Tests/helper.py | 9 +++++---- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/.travis/install.sh b/.travis/install.sh index 64ce477f7..f1e36bb9c 100755 --- a/.travis/install.sh +++ b/.travis/install.sh @@ -8,7 +8,9 @@ sudo apt-get -qq install libfreetype6-dev liblcms2-dev python-tk\ libharfbuzz-dev libfribidi-dev pip install cffi -pip install nose +pip install nose # TODO remove +pip install pytest +pip install pytest-cov pip install check-manifest pip install olefile pip install pyroma diff --git a/.travis/script.sh b/.travis/script.sh index e1d522122..21a70ec7b 100755 --- a/.travis/script.sh +++ b/.travis/script.sh @@ -7,7 +7,8 @@ python setup.py clean CFLAGS="-coverage" python setup.py build_ext --inplace coverage run --append --include=PIL/* selftest.py -coverage run --append --include=PIL/* -m nose -vx Tests/test_*.py +# coverage run --append --include=PIL/* -m nose -vx Tests/test_*.py TODO remove +py.test -v --cov PIL --cov-report term Tests pushd /tmp/check-manifest && check-manifest --ignore ".coveragerc,.editorconfig,*.yml,*.yaml,tox.ini" && popd # Docs diff --git a/Tests/helper.py b/Tests/helper.py index b8b44b6f2..66f8e9d9d 100644 --- a/Tests/helper.py +++ b/Tests/helper.py @@ -64,8 +64,9 @@ class PillowTestCase(unittest.TestCase): try: ok = self.currentResult.wasSuccessful() except AttributeError: # for nosetests - proxy = self.currentResult - ok = (len(proxy.errors) + len(proxy.failures) == 0) + # proxy = self.currentResult + # ok = (len(proxy.errors) + len(proxy.failures) == 0) + ok = True # TODO pytest if ok: # only clean out tempfiles if test passed @@ -256,8 +257,8 @@ class PillowLeakTestCase(PillowTestCase): # linux # man 2 getrusage # ru_maxrss (since Linux 2.6.32) - # This is the maximum resident set size used (in kilobytes). - return mem # Kb + # This is the maximum resident set size used (in kilobytes). + return mem # Kb def _test_leak(self, core): start_mem = self._get_mem_usage() From 474f5bbd66e212776623383aafcca509d6bb5fab Mon Sep 17 00:00:00 2001 From: hugovk Date: Thu, 26 Oct 2017 08:46:19 +0300 Subject: [PATCH 02/16] --cov-append --- .travis/script.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.travis/script.sh b/.travis/script.sh index 21a70ec7b..74c48ea18 100755 --- a/.travis/script.sh +++ b/.travis/script.sh @@ -6,9 +6,9 @@ coverage erase python setup.py clean CFLAGS="-coverage" python setup.py build_ext --inplace -coverage run --append --include=PIL/* selftest.py -# coverage run --append --include=PIL/* -m nose -vx Tests/test_*.py TODO remove -py.test -v --cov PIL --cov-report term Tests +coverage run --append --include="PIL/*" selftest.py +# coverage run --append --include="PIL/*" -m nose -vx Tests/test_*.py TODO remove +py.test -v --cov PIL --cov-append --cov-report term Tests pushd /tmp/check-manifest && check-manifest --ignore ".coveragerc,.editorconfig,*.yml,*.yaml,tox.ini" && popd # Docs From 95487508a6b64e144ddda3c0444a4746900df544 Mon Sep 17 00:00:00 2001 From: Hugo Date: Thu, 26 Oct 2017 16:55:13 +0300 Subject: [PATCH 03/16] Run pytest as module --- .travis/install.sh | 7 +++---- .travis/script.sh | 3 +-- requirements.txt | 4 ++-- 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/.travis/install.sh b/.travis/install.sh index f1e36bb9c..f546d3d43 100755 --- a/.travis/install.sh +++ b/.travis/install.sh @@ -7,14 +7,13 @@ sudo apt-get -qq install libfreetype6-dev liblcms2-dev python-tk\ python-qt4 ghostscript libffi-dev libjpeg-turbo-progs cmake imagemagick\ libharfbuzz-dev libfribidi-dev +pip install check-manifest pip install cffi -pip install nose # TODO remove +pip install coverage +pip install olefile pip install pytest pip install pytest-cov -pip install check-manifest -pip install olefile pip install pyroma -pip install coverage pip install test-image-results # docs only on Python 2.7 diff --git a/.travis/script.sh b/.travis/script.sh index 74c48ea18..a47307ca5 100755 --- a/.travis/script.sh +++ b/.travis/script.sh @@ -7,8 +7,7 @@ python setup.py clean CFLAGS="-coverage" python setup.py build_ext --inplace coverage run --append --include="PIL/*" selftest.py -# coverage run --append --include="PIL/*" -m nose -vx Tests/test_*.py TODO remove -py.test -v --cov PIL --cov-append --cov-report term Tests +python -m pytest -vx --cov PIL --cov-append --cov-report term Tests pushd /tmp/check-manifest && check-manifest --ignore ".coveragerc,.editorconfig,*.yml,*.yaml,tox.ini" && popd # Docs diff --git a/requirements.txt b/requirements.txt index 213f145ab..4cb3c0907 100644 --- a/requirements.txt +++ b/requirements.txt @@ -11,10 +11,10 @@ docutils jarn.viewdoc Jinja2 MarkupSafe -nose -nose-cov olefile pycodestyle +pytest +pytest-cov pyflakes Pygments pyroma From a98a25a126df27d06afefca90e2e12353ad441c4 Mon Sep 17 00:00:00 2001 From: Hugo Date: Thu, 26 Oct 2017 18:07:34 +0300 Subject: [PATCH 04/16] Use pytest instead of nose --- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index d27afaa0b..7310dd1d1 100644 --- a/Makefile +++ b/Makefile @@ -17,7 +17,7 @@ co: coverage: coverage erase coverage run --parallel-mode --include=PIL/* selftest.py - nosetests --with-cov --cov='PIL/' --cov-report=html Tests/test_*.py + python -m pytest --cov PIL --cov-append --cov-report html Tests # Doesn't combine properly before report, writing report instead of displaying invalid report. rm -r htmlcov || true coverage combine @@ -81,7 +81,7 @@ release-test: $(MAKE) install-req python setup.py develop python selftest.py - nosetests Tests/test_*.py + python -m pytest Tests python setup.py install python test-installed.py check-manifest From f4e43be8ed840971f12ea21fb918a59de8d09b46 Mon Sep 17 00:00:00 2001 From: Hugo Date: Sun, 29 Oct 2017 15:11:00 +0200 Subject: [PATCH 05/16] Test with coverage on Windows, update 'setup.py test' --- .gitignore | 9 +++++++++ .travis/install.sh | 6 +++--- .travis/script.sh | 4 ++-- Makefile | 7 ++----- appveyor.yml | 9 +++++++-- setup.cfg | 4 ++++ setup.py | 6 +++++- winbuild/appveyor_install_msys2_deps.sh | 4 ++-- winbuild/build.py | 4 ++-- 9 files changed, 36 insertions(+), 17 deletions(-) diff --git a/.gitignore b/.gitignore index aa45f946f..242f50845 100644 --- a/.gitignore +++ b/.gitignore @@ -6,6 +6,7 @@ __pycache__/ *.so # Distribution / packaging +.eggs/ .Python env/ bin/ @@ -69,3 +70,11 @@ docs/_build/ #OS .DS_Store +# JetBrains +.idea + +# Extra test images installed from pillow-depends/test_images +Tests/images/README.md +Tests/images/msp +Tests/images/picins +Tests/images/sunraster diff --git a/.travis/install.sh b/.travis/install.sh index f546d3d43..cad0e3c32 100755 --- a/.travis/install.sh +++ b/.travis/install.sh @@ -7,12 +7,12 @@ sudo apt-get -qq install libfreetype6-dev liblcms2-dev python-tk\ python-qt4 ghostscript libffi-dev libjpeg-turbo-progs cmake imagemagick\ libharfbuzz-dev libfribidi-dev -pip install check-manifest pip install cffi +pip install check-manifest pip install coverage pip install olefile -pip install pytest -pip install pytest-cov +pip install -U pytest +pip install -U pytest-cov pip install pyroma pip install test-image-results diff --git a/.travis/script.sh b/.travis/script.sh index a47307ca5..1473ab079 100755 --- a/.travis/script.sh +++ b/.travis/script.sh @@ -6,8 +6,8 @@ coverage erase python setup.py clean CFLAGS="-coverage" python setup.py build_ext --inplace -coverage run --append --include="PIL/*" selftest.py -python -m pytest -vx --cov PIL --cov-append --cov-report term Tests +python selftest.py +python setup.py test pushd /tmp/check-manifest && check-manifest --ignore ".coveragerc,.editorconfig,*.yml,*.yaml,tox.ini" && popd # Docs diff --git a/Makefile b/Makefile index 7310dd1d1..8e60024ae 100644 --- a/Makefile +++ b/Makefile @@ -15,12 +15,9 @@ co: done coverage: - coverage erase - coverage run --parallel-mode --include=PIL/* selftest.py - python -m pytest --cov PIL --cov-append --cov-report html Tests -# Doesn't combine properly before report, writing report instead of displaying invalid report. + python selftest.py + python setup.py test rm -r htmlcov || true - coverage combine coverage report doc: diff --git a/appveyor.yml b/appveyor.yml index d966c88ff..a34d4690a 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -74,8 +74,13 @@ build_script: test_script: - cd c:\pillow -- '%PYTHON%\%PIP_DIR%\pip.exe install nose' -- '%PYTHON%\%EXECUTABLE% test-installed.py -v -s %TEST_OPTIONS%' +- '%PYTHON%\%PIP_DIR%\pip.exe install pytest pytest-cov' +- '%PYTHON%\%EXECUTABLE% -m pytest -vx --cov PIL --cov-append --cov-report term --cov-report xml Tests' +#- '%PYTHON%\%EXECUTABLE% test-installed.py -v -s %TEST_OPTIONS%' TODO TEST_OPTIONS with pytest? + +after_test: +- pip install codecov +- codecov --file coverage.xml --name %PYTHON% matrix: fast_finish: true diff --git a/setup.cfg b/setup.cfg index 0c9e0fc14..fb2d177d6 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,2 +1,6 @@ +[aliases] +test=pytest [metadata] license_file = LICENSE +[tool:pytest] +addopts = -vx --cov PIL --cov-append --cov-report term Tests diff --git a/setup.py b/setup.py index a67c5d82a..75e599273 100755 --- a/setup.py +++ b/setup.py @@ -764,6 +764,9 @@ def debug_build(): return hasattr(sys, 'gettotalrefcount') +needs_pytest = {'pytest', 'test', 'ptr'}.intersection(sys.argv) +pytest_runner = ['pytest-runner'] if needs_pytest else [] + try: setup(name=NAME, version=PILLOW_VERSION, @@ -795,7 +798,8 @@ try: ext_modules=[Extension("PIL._imaging", ["_imaging.c"])], include_package_data=True, packages=find_packages(), - test_suite='nose.collector', + setup_requires=pytest_runner, + tests_require=['pytest'], keywords=["Imaging", ], license='Standard PIL License', zip_safe=not (debug_build() or PLATFORM_MINGW), ) diff --git a/winbuild/appveyor_install_msys2_deps.sh b/winbuild/appveyor_install_msys2_deps.sh index 52b814433..b13dc9e98 100644 --- a/winbuild/appveyor_install_msys2_deps.sh +++ b/winbuild/appveyor_install_msys2_deps.sh @@ -7,5 +7,5 @@ pacman -S --noconfirm mingw32/mingw-w64-i686-python3 \ mingw32/mingw-w64-i686-python2-setuptools \ mingw-w64-i686-libjpeg-turbo -/mingw32/bin/pip install nose olefile -/mingw32/bin/pip3 install nose olefile +/mingw32/bin/pip install pytest pytest-cov olefile +/mingw32/bin/pip3 install pytest pytest-cov olefile diff --git a/winbuild/build.py b/winbuild/build.py index 3d6c6e57f..859a40277 100755 --- a/winbuild/build.py +++ b/winbuild/build.py @@ -16,7 +16,7 @@ def setup_vms(): for arch in ('', X64_EXT): ret.append("virtualenv -p c:/Python%s%s/python.exe --clear %s%s%s" % (py, arch, VIRT_BASE, py, arch)) - ret.append(r"%s%s%s\Scripts\pip.exe install nose" % + ret.append(r"%s%s%s\Scripts\pip.exe install pytest pytest-cov" % (VIRT_BASE, py, arch)) return "\n".join(ret) @@ -76,7 +76,7 @@ def build_one(py_ver, compiler): args['executable'] = "python.exe" if 'EXECUTABLE' in os.environ: args['executable'] = "%EXECUTABLE%" - + args['py_ver'] = py_ver if '34' in py_ver: args['tcl_ver'] = '86' From d970cebf67528187855d356e4448a55714d9f8eb Mon Sep 17 00:00:00 2001 From: hugovk Date: Wed, 1 Nov 2017 22:29:45 +0200 Subject: [PATCH 06/16] No need for --cov-append --- appveyor.yml | 2 +- setup.cfg | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index a34d4690a..94886c8b6 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -75,7 +75,7 @@ build_script: test_script: - cd c:\pillow - '%PYTHON%\%PIP_DIR%\pip.exe install pytest pytest-cov' -- '%PYTHON%\%EXECUTABLE% -m pytest -vx --cov PIL --cov-append --cov-report term --cov-report xml Tests' +- '%PYTHON%\%EXECUTABLE% -m pytest -vx --cov PIL --cov-report term --cov-report xml Tests' #- '%PYTHON%\%EXECUTABLE% test-installed.py -v -s %TEST_OPTIONS%' TODO TEST_OPTIONS with pytest? after_test: diff --git a/setup.cfg b/setup.cfg index fb2d177d6..4a1338396 100644 --- a/setup.cfg +++ b/setup.cfg @@ -3,4 +3,4 @@ test=pytest [metadata] license_file = LICENSE [tool:pytest] -addopts = -vx --cov PIL --cov-append --cov-report term Tests +addopts = -vx --cov PIL --cov-report term Tests From 6b337d8d4c9aceb8f7b1dbd3f234944a9d7fcdf6 Mon Sep 17 00:00:00 2001 From: hugovk Date: Wed, 1 Nov 2017 23:31:24 +0200 Subject: [PATCH 07/16] Update test instructions --- Tests/README.rst | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/Tests/README.rst b/Tests/README.rst index 0985e0f26..f0118c629 100644 --- a/Tests/README.rst +++ b/Tests/README.rst @@ -8,7 +8,7 @@ Dependencies Install:: - pip install coverage nose + pip install pytest pytest-cov Execution --------- @@ -21,12 +21,11 @@ To run an individual test:: Run all the tests from the root of the Pillow source distribution:: - nosetests -vx Tests/test_*.py + pytest -vx Tests Or with coverage:: - coverage run --append --include=PIL/* -m nose -vx Tests/test_*.py - coverage report + pytest -vx --cov PIL --cov-report term Tests coverage html open htmlcov/index.html @@ -39,6 +38,3 @@ To run an individual test:: Run all the tests from the root of the Pillow source distribution:: ./test-installed.py - - - From cf20563fa0b63b4df48e46c2198d41375f8393dc Mon Sep 17 00:00:00 2001 From: Hugo Date: Mon, 6 Nov 2017 18:40:23 +0200 Subject: [PATCH 08/16] Update with pytest --- test-installed.py | 31 ++++++++++++++----------------- 1 file changed, 14 insertions(+), 17 deletions(-) diff --git a/test-installed.py b/test-installed.py index c5aff1360..7269b3494 100755 --- a/test-installed.py +++ b/test-installed.py @@ -1,8 +1,8 @@ #!/usr/bin/env python -import nose import os import sys -import glob + +import pytest # monkey with the path, removing the local directory but adding the Tests/ # directory for helper.py and the other local imports there. @@ -13,23 +13,20 @@ sys.path.insert(0, os.path.abspath('./Tests')) # if there's no test selected (mostly) choose a working default. # Something is required, because if we import the tests from the local # directory, once again, we've got the non-installed PIL in the way -for arg in sys.argv[1:]: - if '.py' in arg: +for i, arg in enumerate(sys.argv[1:]): + print(i, arg) + if arg.startswith('Tests/test_') and arg.endswith('.py'): + print("bingo") + sys.argv.insert(i+1, '-k') break else: - sys.argv.extend(glob.glob('Tests/test*.py')) + sys.argv.append('Tests') -# Make sure that nose doesn't muck with our paths. -if ('--no-path-adjustment' not in sys.argv) and ('-P' not in sys.argv): - sys.argv.insert(1, '--no-path-adjustment') - -if 'NOSE_PROCESSES' not in os.environ: - for arg in sys.argv: - if '--processes' in arg: - break - else: # for - sys.argv.insert(1, '--processes=-1') # -1 == number of cores - sys.argv.insert(1, '--process-timeout=30') +# for arg in sys.argv: +# if '-n' in arg or '--numprocesses' in arg: +# break +# else: # for +# sys.argv.extend(['--numprocesses' ,'auto']) # auto-detect number of CPUs if __name__ == '__main__': - nose.main() + pytest.main() From 2edd1b66dba98549d03356923c642adb34bf0438 Mon Sep 17 00:00:00 2001 From: Hugo Date: Tue, 7 Nov 2017 12:35:46 +0200 Subject: [PATCH 09/16] Remove unused/unrunnable profile-installed.py --- profile-installed.py | 25 ------------------------- 1 file changed, 25 deletions(-) delete mode 100755 profile-installed.py diff --git a/profile-installed.py b/profile-installed.py deleted file mode 100755 index e3a04c21c..000000000 --- a/profile-installed.py +++ /dev/null @@ -1,25 +0,0 @@ -#!/usr/bin/env python -import os -import sys -import glob - -import profile - -# monkey with the path, removing the local directory but adding the Tests/ -# directory for helper.py and the other local imports there. - -del(sys.path[0]) -sys.path.insert(0, os.path.abspath('./Tests')) - -# if there's no test selected (mostly) choose a working default. -# Something is required, because if we import the tests from the local -# directory, once again, we've got the non-installed PIL in the way -if len(sys.argv) == 1: - sys.argv.extend(glob.glob('Tests/test*.py')) - -# Make sure that nose doesn't muck with our paths. -if ('--no-path-adjustment' not in sys.argv) and ('-P' not in sys.argv): - sys.argv.insert(1, '--no-path-adjustment') - -if __name__ == '__main__': - profile.run("nose.main()", sort=2) From a8c29f92399308b39c195f95c92f3fd728e966e0 Mon Sep 17 00:00:00 2001 From: hugovk Date: Wed, 15 Nov 2017 22:22:52 +0200 Subject: [PATCH 10/16] Test with multiprocessing --- test-installed.py | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/test-installed.py b/test-installed.py index 7269b3494..35a3b4ccc 100755 --- a/test-installed.py +++ b/test-installed.py @@ -14,19 +14,18 @@ sys.path.insert(0, os.path.abspath('./Tests')) # Something is required, because if we import the tests from the local # directory, once again, we've got the non-installed PIL in the way for i, arg in enumerate(sys.argv[1:]): - print(i, arg) if arg.startswith('Tests/test_') and arg.endswith('.py'): - print("bingo") sys.argv.insert(i+1, '-k') break else: sys.argv.append('Tests') -# for arg in sys.argv: -# if '-n' in arg or '--numprocesses' in arg: -# break -# else: # for -# sys.argv.extend(['--numprocesses' ,'auto']) # auto-detect number of CPUs +for arg in sys.argv: + if '-n' in arg or '--numprocesses' in arg: + break +else: # for + sys.argv.extend(['--numprocesses', 'auto']) # auto-detect number of CPUs + if __name__ == '__main__': pytest.main() From 3c2e14892f172887a960f878d2afda379a5a2664 Mon Sep 17 00:00:00 2001 From: hugovk Date: Thu, 16 Nov 2017 18:27:07 +0200 Subject: [PATCH 11/16] 'Make test' calls 'pytest -qq' directly --- Makefile | 2 +- test-installed.py | 31 ------------------------------- 2 files changed, 1 insertion(+), 32 deletions(-) delete mode 100755 test-installed.py diff --git a/Makefile b/Makefile index 8e60024ae..7d9d34472 100644 --- a/Makefile +++ b/Makefile @@ -89,7 +89,7 @@ sdist: python setup.py sdist --format=gztar test: - python test-installed.py + pytest -qq # https://docs.python.org/2/distutils/packageindex.html#the-pypirc-file upload-test: diff --git a/test-installed.py b/test-installed.py deleted file mode 100755 index 35a3b4ccc..000000000 --- a/test-installed.py +++ /dev/null @@ -1,31 +0,0 @@ -#!/usr/bin/env python -import os -import sys - -import pytest - -# monkey with the path, removing the local directory but adding the Tests/ -# directory for helper.py and the other local imports there. - -del(sys.path[0]) -sys.path.insert(0, os.path.abspath('./Tests')) - -# if there's no test selected (mostly) choose a working default. -# Something is required, because if we import the tests from the local -# directory, once again, we've got the non-installed PIL in the way -for i, arg in enumerate(sys.argv[1:]): - if arg.startswith('Tests/test_') and arg.endswith('.py'): - sys.argv.insert(i+1, '-k') - break -else: - sys.argv.append('Tests') - -for arg in sys.argv: - if '-n' in arg or '--numprocesses' in arg: - break -else: # for - sys.argv.extend(['--numprocesses', 'auto']) # auto-detect number of CPUs - - -if __name__ == '__main__': - pytest.main() From 102e8725fdd93308268ed49135b5f28587d81636 Mon Sep 17 00:00:00 2001 From: hugovk Date: Tue, 12 Dec 2017 22:55:11 +0200 Subject: [PATCH 12/16] pytest no longer supports EOL Python 3.3 --- .travis.yml | 1 - Tests/test_image_access.py | 8 ++++---- appveyor.yml | 2 -- docs/installation.rst | 10 ++++++---- mp_compile.py | 11 ++--------- setup.py | 3 +-- winbuild/README.md | 14 +++++++------- winbuild/get_pythons.py | 2 +- 8 files changed, 21 insertions(+), 30 deletions(-) diff --git a/.travis.yml b/.travis.yml index ef7adc63d..d208c4165 100644 --- a/.travis.yml +++ b/.travis.yml @@ -17,7 +17,6 @@ matrix: - python: "2.7_with_system_site_packages" # For PyQt4 - python: '3.5' - python: '3.4' - - python: '3.3' - python: '3.7-dev' - env: DOCKER="alpine" - env: DOCKER="arch" # contains PyQt5 diff --git a/Tests/test_image_access.py b/Tests/test_image_access.py index 9cb27774d..d0fcea1d4 100644 --- a/Tests/test_image_access.py +++ b/Tests/test_image_access.py @@ -251,7 +251,7 @@ class TestCffi(AccessTest): class TestEmbeddable(unittest.TestCase): @unittest.skipIf(not sys.platform.startswith('win32') or - sys.version_info[:2] in ((3, 3), (3, 4)) or + sys.version_info[:2] == (3, 4) or on_appveyor(), # failing on appveyor when run from # subprocess, not from shell "requires Python 2.7 or >=3.5 for Windows") @@ -293,7 +293,7 @@ int main(int argc, char* argv[]) compiler = ccompiler.new_compiler() compiler.add_include_dir(sysconfig.get_python_inc()) - + libdir = sysconfig.get_config_var('LIBDIR') or sysconfig.get_python_inc().replace('include', 'libs') print (libdir) compiler.add_library_dir(libdir) @@ -302,10 +302,10 @@ int main(int argc, char* argv[]) env = os.environ.copy() env["PATH"] = sys.prefix + ';' + env["PATH"] - + # do not display the Windows Error Reporting dialog ctypes.windll.kernel32.SetErrorMode(0x0002) - + process = subprocess.Popen(['embed_pil.exe'], env=env) process.communicate() self.assertEqual(process.returncode, 0) diff --git a/appveyor.yml b/appveyor.yml index 94886c8b6..8e995e601 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -21,8 +21,6 @@ environment: - PYTHON: C:/Python34 - PYTHON: C:/Python27 - PYTHON: C:/Python34-x64 - - PYTHON: C:/Python33 - - PYTHON: C:/Python33-x64 - PYTHON: C:/msys64/mingw32 EXECUTABLE: bin/python3 PIP_DIR: bin diff --git a/docs/installation.rst b/docs/installation.rst index 5dae41045..6d36584d2 100644 --- a/docs/installation.rst +++ b/docs/installation.rst @@ -17,7 +17,9 @@ Notes .. note:: Pillow >= 2.0.0 < 4.0.0 supports Python versions 2.6, 2.7, 3.2, 3.3, 3.4, 3.5 -.. note:: Pillow >= 4.0.0 supports Python versions 2.7, 3.3, 3.4, 3.5, 3.6 +.. note:: Pillow >= 4.0.0 < 4.4.0 supports Python versions 2.7, 3.3, 3.4, 3.5, 3.6 + +.. note:: Pillow >= 4.4.0 supports Python versions 2.7, 3.4, 3.5, 3.6 Basic Installation ------------------ @@ -378,16 +380,16 @@ These platforms are built and tested for every change. +----------------------------------+-------------------------------+-----------------------+ | Fedora 26 | 2.7 |x86-64 | +----------------------------------+-------------------------------+-----------------------+ -| Mac OS X 10.10 Yosemite* | 2.7, 3.3, 3.4, 3.5, 3.6 |x86-64 | +| Mac OS X 10.10 Yosemite* | 2.7, 3.4, 3.5, 3.6 |x86-64 | +----------------------------------+-------------------------------+-----------------------+ | Ubuntu Linux 16.04 LTS | 2.7 |x86-64 | +----------------------------------+-------------------------------+-----------------------+ -| Ubuntu Linux 14.04 LTS | 2.7, 3.3, 3.4, 3.5, 3.6, |x86-64 | +| Ubuntu Linux 14.04 LTS | 2.7, 3.4, 3.5, 3.6, |x86-64 | | | pypy, pypy3 | | | | | | | | 2.7 |x86 | +----------------------------------+-------------------------------+-----------------------+ -| Windows Server 2012 R2 | 2.7, 3.3, 3.4 |x86, x86-64 | +| Windows Server 2012 R2 | 2.7, 3.4 |x86, x86-64 | | | | | | | pypy, 3.5/mingw |x86 | +----------------------------------+-------------------------------+-----------------------+ diff --git a/mp_compile.py b/mp_compile.py index 59f14a651..5fac2399f 100644 --- a/mp_compile.py +++ b/mp_compile.py @@ -54,19 +54,12 @@ def _mp_compile(self, sources, output_dir=None, macros=None, def install(): - fl_pypy3 = (hasattr(sys, 'pypy_version_info') and - (3, 0) < sys.version_info < (3, 3)) fl_win = sys.platform.startswith('win') fl_cygwin = sys.platform.startswith('cygwin') - if fl_pypy3: - # see https://github.com/travis-ci/travis-ci/issues/3587 - print("Single threaded build for pypy3") - return - if fl_win or fl_cygwin: - # windows barfs on multiprocessing installs - print("Single threaded build for windows") + # Windows barfs on multiprocessing installs + print("Single threaded build for Windows") return if MAX_PROCS != 1: diff --git a/setup.py b/setup.py index 75e599273..40a0cffbb 100755 --- a/setup.py +++ b/setup.py @@ -786,14 +786,13 @@ try: "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.3", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: Implementation :: CPython", "Programming Language :: Python :: Implementation :: PyPy", ], - python_requires=">=2.7, !=3.0.*, !=3.1.*, !=3.2.*", + python_requires=">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*", cmdclass={"build_ext": pil_build_ext}, ext_modules=[Extension("PIL._imaging", ["_imaging.c"])], include_package_data=True, diff --git a/winbuild/README.md b/winbuild/README.md index 89d60de62..5ecbf18c6 100644 --- a/winbuild/README.md +++ b/winbuild/README.md @@ -1,18 +1,18 @@ Quick README ------------- +------------ -For more extensive info, see the windows build instructions `docs/build.rst`. +For more extensive info, see the Windows build instructions `docs/build.rst`. -* See https://github.com/python-pillow/Pillow/issues/553#issuecomment-37877416 and https://github.com/matplotlib/matplotlib/issues/1717#issuecomment-13343859 +* See https://github.com/python-pillow/Pillow/issues/553#issuecomment-37877416 and https://github.com/matplotlib/matplotlib/issues/1717#issuecomment-13343859 * Works best with Python 3.4, due to virtualenv and pip batteries included. Python3+ required for fetch command. * Check config.py for virtual env paths, suffix for 64-bit releases. Defaults to `x64`, set `X64_EXT` to change. * When running in CI with one Python per invocation, set the `PYTHON` env variable to the Python folder. (e.g. `PYTHON`=`c:\Python27\`) This overrides the matrix in config.py and will just build and test for the specific Python. * `python get_pythons.py` downloads all the Python releases, and their signatures. (Manually) Install in `c:\PythonXX[x64]\`. -* `python build_dep.py` downloads and creates a build script for all the dependencies, in 32 and 64 bit versions, and with both compiler versions. +* `python build_dep.py` downloads and creates a build script for all the dependencies, in 32 and 64-bit versions, and with both compiler versions. * (in powershell) `build_deps.cmd` invokes the dependency build. * `python build.py --clean` makes Pillow for the matrix of Pythons. * `python test.py` runs the tests on Pillow in all the virtual envs. -* Currently working with zlib, libjpeg, freetype, and libtiff on Python 2.7, 3.3, and 3.4, both 32 and 64 bit, on a local win7 pro machine and appveyor.com -* Webp is built, not detected. -* LCMS, OpenJpeg and libimagequant are not building. +* Currently working with zlib, libjpeg, freetype, and libtiff on Python 2.7, and 3.4, both 32 and 64-bit, on a local win7 pro machine and appveyor.com +* WebP is built, not detected. +* LCMS, OpenJPEG and libimagequant are not building. diff --git a/winbuild/get_pythons.py b/winbuild/get_pythons.py index 481283df3..448450afb 100644 --- a/winbuild/get_pythons.py +++ b/winbuild/get_pythons.py @@ -2,7 +2,7 @@ from fetch import fetch import os if __name__ == '__main__': - for version in ['2.7.10', '3.3.5', '3.4.3']: + for version in ['2.7.10', '3.4.3']: for platform in ['', '.amd64']: for extension in ['', '.asc']: fetch('https://www.python.org/ftp/python/%s/python-%s%s.msi%s' From b8a64c789eeeffb7dc67cdac2b384a8d34e3e6d6 Mon Sep 17 00:00:00 2001 From: Hugo Date: Wed, 13 Dec 2017 14:59:25 +0200 Subject: [PATCH 13/16] Major version bump and release note for dropped Python 3.3 --- CHANGES.rst | 2 +- PIL/version.py | 2 +- docs/installation.rst | 4 ++-- docs/releasenotes/{4.4.0.rst => 5.0.0.rst} | 14 ++++++++++++-- docs/releasenotes/index.rst | 2 +- 5 files changed, 17 insertions(+), 7 deletions(-) rename docs/releasenotes/{4.4.0.rst => 5.0.0.rst} (64%) diff --git a/CHANGES.rst b/CHANGES.rst index 3c3fbaa1f..f8f8420da 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -2,7 +2,7 @@ Changelog (Pillow) ================== -4.4.0 (unreleased) +5.0.0 (unreleased) ------------------ - Removed scripts directory #2901 diff --git a/PIL/version.py b/PIL/version.py index 0718fd601..b89052c73 100644 --- a/PIL/version.py +++ b/PIL/version.py @@ -1,2 +1,2 @@ # Master version for Pillow -__version__ = '4.4.0.dev0' +__version__ = '5.0.0.dev0' diff --git a/docs/installation.rst b/docs/installation.rst index 6d36584d2..5c56d3700 100644 --- a/docs/installation.rst +++ b/docs/installation.rst @@ -17,9 +17,9 @@ Notes .. note:: Pillow >= 2.0.0 < 4.0.0 supports Python versions 2.6, 2.7, 3.2, 3.3, 3.4, 3.5 -.. note:: Pillow >= 4.0.0 < 4.4.0 supports Python versions 2.7, 3.3, 3.4, 3.5, 3.6 +.. note:: Pillow >= 4.0.0 < 5.0.0 supports Python versions 2.7, 3.3, 3.4, 3.5, 3.6 -.. note:: Pillow >= 4.4.0 supports Python versions 2.7, 3.4, 3.5, 3.6 +.. note:: Pillow >= 5.0.0 supports Python versions 2.7, 3.4, 3.5, 3.6 Basic Installation ------------------ diff --git a/docs/releasenotes/4.4.0.rst b/docs/releasenotes/5.0.0.rst similarity index 64% rename from docs/releasenotes/4.4.0.rst rename to docs/releasenotes/5.0.0.rst index 101a513df..886b673c0 100644 --- a/docs/releasenotes/4.4.0.rst +++ b/docs/releasenotes/5.0.0.rst @@ -1,6 +1,17 @@ -4.4.0 +5.0.0 ----- +Backwards Incompatible Changes +============================== + +Python 3.3 Dropped +^^^^^^^^^^^^^^^^^^ + +Python 3.3 is EOL and no longer supported due to moving testing from nose, +which is deprecated, to pytest, which doesn't support Python 3.3. We will not +be creating binaries, testing, or retaining compatibility with this version. +The final version of Pillow for Python 3.3 is 4.3.0. + API Changes =========== @@ -17,7 +28,6 @@ Further, the vendored version was removed in Pillow 4.0.0 and replaced with a deprecation warning that PIL.OleFileIO would be removed in a future version. This warning has been upgraded to an import error pending future removal. - API Additions ============= diff --git a/docs/releasenotes/index.rst b/docs/releasenotes/index.rst index 27fc61870..0ee853fca 100644 --- a/docs/releasenotes/index.rst +++ b/docs/releasenotes/index.rst @@ -6,7 +6,7 @@ Release Notes .. toctree:: :maxdepth: 2 - 4.4.0 + 5.0.0 4.3.0 4.2.1 4.2.0 From 547b38041af5f782a355ba62737253bf86fdb7e1 Mon Sep 17 00:00:00 2001 From: Hugo Date: Wed, 13 Dec 2017 15:49:21 +0200 Subject: [PATCH 14/16] Calls pytest directly --- Makefile | 2 +- Tests/README.rst | 4 ++-- tox.ini | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index 7d9d34472..bdf7ce9b4 100644 --- a/Makefile +++ b/Makefile @@ -80,7 +80,7 @@ release-test: python selftest.py python -m pytest Tests python setup.py install - python test-installed.py + python -m pytest -qq check-manifest pyroma . viewdoc diff --git a/Tests/README.rst b/Tests/README.rst index f0118c629..68c001fdd 100644 --- a/Tests/README.rst +++ b/Tests/README.rst @@ -33,8 +33,8 @@ Or with coverage:: To run an individual test:: - ./test-installed.py Tests/test_image.py + pytest Tests/test_image.py Run all the tests from the root of the Pillow source distribution:: - ./test-installed.py + pytest diff --git a/tox.ini b/tox.ini index 84ac7135e..0d2e41765 100644 --- a/tox.ini +++ b/tox.ini @@ -11,4 +11,4 @@ commands = {envpython} setup.py clean {envpython} setup.py build_ext --inplace {envpython} selftest.py - {envpython} test-installed.py --installed + {envpython} -m pytest -qq From 512198c650bb3db4bd14970c93aa59d4c81a43ad Mon Sep 17 00:00:00 2001 From: Hugo Date: Wed, 13 Dec 2017 15:53:15 +0200 Subject: [PATCH 15/16] Remove nose-specific code --- Tests/helper.py | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/Tests/helper.py b/Tests/helper.py index 66f8e9d9d..fdeb00c0c 100644 --- a/Tests/helper.py +++ b/Tests/helper.py @@ -63,10 +63,8 @@ class PillowTestCase(unittest.TestCase): def delete_tempfile(self, path): try: ok = self.currentResult.wasSuccessful() - except AttributeError: # for nosetests - # proxy = self.currentResult - # ok = (len(proxy.errors) + len(proxy.failures) == 0) - ok = True # TODO pytest + except AttributeError: # for pytest + ok = True if ok: # only clean out tempfiles if test passed @@ -211,10 +209,6 @@ class PillowTestCase(unittest.TestCase): if skip: self.skipTest(msg or "Known Bad Test") - def shortDescription(self): - # Prevents `nose -v` printing docstrings - return None - def tempfile(self, template): assert template[:5] in ("temp.", "temp_") fd, path = tempfile.mkstemp(template[4:], template[:4]) From 83e6469d9bc47748bb3a4510e57dbd7086defb22 Mon Sep 17 00:00:00 2001 From: Hugo Date: Thu, 28 Dec 2017 12:02:13 +0200 Subject: [PATCH 16/16] No need to run coverage on dev machines --- .travis/script.sh | 3 ++- Tests/README.rst | 2 +- setup.cfg | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/.travis/script.sh b/.travis/script.sh index 1473ab079..a67b9da3b 100755 --- a/.travis/script.sh +++ b/.travis/script.sh @@ -7,7 +7,8 @@ python setup.py clean CFLAGS="-coverage" python setup.py build_ext --inplace python selftest.py -python setup.py test +python -m pytest -vx --cov PIL --cov-report term Tests + pushd /tmp/check-manifest && check-manifest --ignore ".coveragerc,.editorconfig,*.yml,*.yaml,tox.ini" && popd # Docs diff --git a/Tests/README.rst b/Tests/README.rst index 68c001fdd..44f6f4792 100644 --- a/Tests/README.rst +++ b/Tests/README.rst @@ -33,7 +33,7 @@ Or with coverage:: To run an individual test:: - pytest Tests/test_image.py + pytest -k Tests/test_image.py Run all the tests from the root of the Pillow source distribution:: diff --git a/setup.cfg b/setup.cfg index 4a1338396..8032517f6 100644 --- a/setup.cfg +++ b/setup.cfg @@ -3,4 +3,4 @@ test=pytest [metadata] license_file = LICENSE [tool:pytest] -addopts = -vx --cov PIL --cov-report term Tests +addopts = -vx Tests