From d514c1fb647a42b3c5d3649540678b6c59a48d04 Mon Sep 17 00:00:00 2001 From: hugovk Date: Wed, 2 Apr 2014 11:00:43 +0300 Subject: [PATCH 01/23] Add coverage report --- .travis.yml | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/.travis.yml b/.travis.yml index d68de0b32..1c6f8385e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,8 +4,8 @@ language: python virtualenv: system_site_packages: true -notifications: - irc: "chat.freenode.net#pil" +# notifications: + # irc: "chat.freenode.net#pil" python: - 2.6 @@ -14,21 +14,26 @@ python: - 3.3 - "pypy" -install: +install: - "sudo apt-get -qq install libfreetype6-dev liblcms2-dev python-qt4 ghostscript libffi-dev cmake" - "pip install cffi" + - "pip install coveralls" - # webp + # webp - pushd depends && ./install_webp.sh && popd # openjpeg - pushd depends && ./install_openjpeg.sh && popd script: + - coverage erase - python setup.py clean - python setup.py build_ext --inplace - - python selftest.py - - python Tests/run.py + - coverage run --append selftest.py + - coverage run --append Tests/run.py + +after_success: + - coveralls matrix: allow_failures: From cd987294365764b9a1c3d747775bc7c530b0c6d7 Mon Sep 17 00:00:00 2001 From: hugovk Date: Wed, 2 Apr 2014 11:40:40 +0300 Subject: [PATCH 02/23] Omit library modules from coverage --- .travis.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 1c6f8385e..9a618fc2b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -29,10 +29,11 @@ script: - coverage erase - python setup.py clean - python setup.py build_ext --inplace - - coverage run --append selftest.py - - coverage run --append Tests/run.py + - coverage run --append --omit=/usr/* selftest.py + - coverage run --append --omit=/usr/* Tests/run.py after_success: + - coverage report - coveralls matrix: From b6d44fe31c7a3176f1a203cebed490cc078a8ab1 Mon Sep 17 00:00:00 2001 From: hugovk Date: Wed, 2 Apr 2014 11:57:02 +0300 Subject: [PATCH 03/23] Only measure coverage of code in the PIL directory, but includes all those files, even those unexecuted --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 9a618fc2b..c4319bfcb 100644 --- a/.travis.yml +++ b/.travis.yml @@ -29,8 +29,8 @@ script: - coverage erase - python setup.py clean - python setup.py build_ext --inplace - - coverage run --append --omit=/usr/* selftest.py - - coverage run --append --omit=/usr/* Tests/run.py + - coverage run --append --source=PIL selftest.py + - coverage run --append --source=PIL Tests/run.py after_success: - coverage report From ec0c933a3ccd0bb32ff55f6d57d7c26a84cba065 Mon Sep 17 00:00:00 2001 From: hugovk Date: Wed, 2 Apr 2014 12:12:47 +0300 Subject: [PATCH 04/23] Include PIL/*.py for coverage to see if it includes unexecuted code --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index c4319bfcb..0b232ec07 100644 --- a/.travis.yml +++ b/.travis.yml @@ -29,8 +29,8 @@ script: - coverage erase - python setup.py clean - python setup.py build_ext --inplace - - coverage run --append --source=PIL selftest.py - - coverage run --append --source=PIL Tests/run.py + - coverage run --append --include=PIL/* selftest.py + - coverage run --append --include=PIL/* Tests/run.py after_success: - coverage report From 4474917fc292d283a0402f2fedad2ef3c4a820fb Mon Sep 17 00:00:00 2001 From: hugovk Date: Wed, 2 Apr 2014 13:53:34 +0300 Subject: [PATCH 05/23] Re-enable notifications --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 0b232ec07..0cabcc35d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,8 +4,8 @@ language: python virtualenv: system_site_packages: true -# notifications: - # irc: "chat.freenode.net#pil" +notifications: + irc: "chat.freenode.net#pil" python: - 2.6 From 5e0d2a30044861fa93a55c4788e28143002eed96 Mon Sep 17 00:00:00 2001 From: hugovk Date: Sat, 5 Apr 2014 01:25:55 +0300 Subject: [PATCH 06/23] Add pep8 and pyflakes reports to Travis CI --- .travis.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.travis.yml b/.travis.yml index 0cabcc35d..b104b65e2 100644 --- a/.travis.yml +++ b/.travis.yml @@ -35,6 +35,9 @@ script: after_success: - coverage report - coveralls + - pip install pep8 pyflakes + - pep8 PIL/*.py + - pyflakes PIL/*.py matrix: allow_failures: From 07650be8320c85883392e90cfea63c2e7da5d52f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20=C4=8Ciha=C5=99?= Date: Mon, 7 Apr 2014 17:36:36 +0200 Subject: [PATCH 07/23] Fix variable name Wrong variable name was used for transparency manipulations. --- PIL/Image.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PIL/Image.py b/PIL/Image.py index 18d2c8267..54c68e2dc 100644 --- a/PIL/Image.py +++ b/PIL/Image.py @@ -807,7 +807,7 @@ class Image: new_im = self._new(im) if delete_trns: #crash fail if we leave a bytes transparency in an rgb/l mode. - del(new.info['transparency']) + del(new_im.info['transparency']) if trns is not None: if new_im.mode == 'P': try: From e0b7f86cf65700753029869fae26bb71cf90df7b Mon Sep 17 00:00:00 2001 From: Alex Clark Date: Mon, 7 Apr 2014 18:37:40 -0400 Subject: [PATCH 08/23] Add history --- CHANGES.rst | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CHANGES.rst b/CHANGES.rst index 49946c36c..346ba7101 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -1,6 +1,12 @@ Changelog (Pillow) ================== +2.5.0 (unreleased) +------------------ + +- Fix variable name used for transparency manipulations + [nijel] + 2.4.0 (2014-04-01) ------------------ From 844ed441deb6b75d3048fa111977188ed47f0b76 Mon Sep 17 00:00:00 2001 From: wiredfool Date: Mon, 7 Apr 2014 15:59:33 -0700 Subject: [PATCH 09/23] Add the suffix if it's not there, not if it is --- PIL/Image.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PIL/Image.py b/PIL/Image.py index 54c68e2dc..40a467d12 100644 --- a/PIL/Image.py +++ b/PIL/Image.py @@ -513,7 +513,7 @@ class Image: if not format or format == "PPM": self.im.save_ppm(file) else: - if file.endswith(format): + if not file.endswith(format): file = file + "." + format self.save(file, format) return file From 86d5c5c3894f58895f31287081cdd146f5fe00f7 Mon Sep 17 00:00:00 2001 From: wiredfool Date: Mon, 7 Apr 2014 16:01:49 -0700 Subject: [PATCH 10/23] Have the tempfile use a suffix with a dot --- PIL/Image.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/PIL/Image.py b/PIL/Image.py index 40a467d12..359aae716 100644 --- a/PIL/Image.py +++ b/PIL/Image.py @@ -505,8 +505,11 @@ class Image: def _dump(self, file=None, format=None): import tempfile, os + suffix = '' + if format: + suffix = '.'+format if not file: - f, file = tempfile.mkstemp(format or '') + f, file = tempfile.mkstemp(suffix) os.close(f) self.load() From 57d4efbeb8967b36d9dd0d1b49748bc6cfae229a Mon Sep 17 00:00:00 2001 From: Alex Clark Date: Mon, 7 Apr 2014 19:18:32 -0400 Subject: [PATCH 11/23] Add history --- CHANGES.rst | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGES.rst b/CHANGES.rst index 346ba7101..f83c6f339 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -4,6 +4,9 @@ Changelog (Pillow) 2.5.0 (unreleased) ------------------ +- Have the tempfile use a suffix with a dot + [wiredfool] + - Fix variable name used for transparency manipulations [nijel] From e4b8cdac4c5146c48f5ed2634b5d005df37ad7ad Mon Sep 17 00:00:00 2001 From: hugovk Date: Tue, 8 Apr 2014 12:22:39 +0300 Subject: [PATCH 12/23] Update .gitignore from https://github.com/github/gitignore keeping Vim and emacs cruft --- .gitignore | 59 ++++++++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 53 insertions(+), 6 deletions(-) diff --git a/.gitignore b/.gitignore index f16a1f9a8..a0ba1b4c1 100644 --- a/.gitignore +++ b/.gitignore @@ -1,10 +1,56 @@ -*.pyc -*.egg-info -build -dist -.tox +# Byte-compiled / optimized / DLL files +__pycache__/ +*.py[cod] + +# C extensions *.so -docs/_build + +# Distribution / packaging +.Python +env/ +bin/ +build/ +develop-eggs/ +dist/ +eggs/ +lib/ +lib64/ +parts/ +sdist/ +var/ +*.egg-info/ +.installed.cfg +*.egg + +# Installer logs +pip-log.txt +pip-delete-this-directory.txt + +# Unit test / coverage reports +htmlcov/ +.tox/ +.coverage +.cache +nosetests.xml +coverage.xml + +# Translations +*.mo + +# Mr Developer +.mr.developer.cfg +.project +.pydevproject + +# Rope +.ropeproject + +# Django stuff: +*.log +*.pot + +# Sphinx documentation +docs/_build/ # Vim cruft .*.swp @@ -13,3 +59,4 @@ docs/_build *~ \#*# .#* + From 3e9cde4412bf86a646139f627a71ecf6e8d3796b Mon Sep 17 00:00:00 2001 From: hugovk Date: Tue, 8 Apr 2014 12:28:00 +0300 Subject: [PATCH 13/23] Use tester.py's built-in coverage and coverage.py's built-in cleanup --- .travis.yml | 2 +- Tests/tester.py | 9 +-------- 2 files changed, 2 insertions(+), 9 deletions(-) diff --git a/.travis.yml b/.travis.yml index b104b65e2..34ffcfe1a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -30,7 +30,7 @@ script: - python setup.py clean - python setup.py build_ext --inplace - coverage run --append --include=PIL/* selftest.py - - coverage run --append --include=PIL/* Tests/run.py + - python Tests/run.py --coverage after_success: - coverage report diff --git a/Tests/tester.py b/Tests/tester.py index f7e2c26c6..8543a0d28 100644 --- a/Tests/tester.py +++ b/Tests/tester.py @@ -83,7 +83,7 @@ def assert_deep_equal(a, b, msg=None): else: failure(msg or "got %s, expected %s" % (a,b)) else: - failure(msg or "got length %s, expected %s" % (len(a), len(b))) + failure(msg or "got length %s, expected %s" % (len(a), len(b))) except: assert_equal(a,b,msg) @@ -285,13 +285,6 @@ def _setup(): except OSError: pass - if "--coverage" in sys.argv: - import coverage - coverage.stop() - # The coverage module messes up when used from inside an - # atexit handler. Do an explicit save to make sure that - # we actually flush the coverage cache. - coverage.the_coverage.save() import atexit, sys atexit.register(report) if "--coverage" in sys.argv: From ed00b2e6d29e18aef4a6419fae9d06b091fa65d0 Mon Sep 17 00:00:00 2001 From: hugovk Date: Tue, 8 Apr 2014 12:38:30 +0300 Subject: [PATCH 14/23] Read existing data coverage on measurement start, save on stop. Only measure PIL code. --- Tests/tester.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Tests/tester.py b/Tests/tester.py index 8543a0d28..f2d11ed14 100644 --- a/Tests/tester.py +++ b/Tests/tester.py @@ -289,7 +289,8 @@ def _setup(): atexit.register(report) if "--coverage" in sys.argv: import coverage - coverage.start() + cov = coverage.coverage(auto_data=True, include="PIL/*") + cov .start() if "--log" in sys.argv: _logfile = open("test.log", "a") From 5afdd6cb541e89bcf21816a76a6934576c4d0f3e Mon Sep 17 00:00:00 2001 From: hugovk Date: Tue, 8 Apr 2014 17:17:10 +0300 Subject: [PATCH 15/23] pep8 Tests/tester.py --- Tests/tester.py | 83 +++++++++++++++++++++++++++++++++++-------------- 1 file changed, 59 insertions(+), 24 deletions(-) diff --git a/Tests/tester.py b/Tests/tester.py index f2d11ed14..510486b1f 100644 --- a/Tests/tester.py +++ b/Tests/tester.py @@ -6,15 +6,13 @@ warnings.simplefilter('default') # temporarily turn off resource warnings that warn about unclosed # files in the test scripts. try: - warnings.filterwarnings("ignore", category=ResourceWarning) + warnings.filterwarnings("ignore", category=ResourceWarning) except NameError: - # we expect a NameError on py2.x, since it doesn't have ResourceWarnings. - pass - - + # we expect a NameError on py2.x, since it doesn't have ResourceWarnings. + pass import sys -py3 = (sys.version_info >= (3,0)) +py3 = (sys.version_info >= (3, 0)) # some test helpers @@ -22,6 +20,7 @@ _target = None _tempfiles = [] _logfile = None + def success(): import sys success.count += 1 @@ -29,8 +28,10 @@ def success(): print(sys.argv[0], success.count, failure.count, file=_logfile) return True + def failure(msg=None, frame=None): - import sys, linecache + import sys + import linecache failure.count += 1 if _target: if frame is None: @@ -49,6 +50,7 @@ def failure(msg=None, frame=None): success.count = failure.count = 0 + # predicates def assert_true(v, msg=None): @@ -57,35 +59,39 @@ def assert_true(v, msg=None): else: failure(msg or "got %r, expected true value" % v) + def assert_false(v, msg=None): if v: failure(msg or "got %r, expected false value" % v) else: success() + def assert_equal(a, b, msg=None): if a == b: success() else: failure(msg or "got %r, expected %r" % (a, b)) + def assert_almost_equal(a, b, msg=None, eps=1e-6): if abs(a-b) < eps: success() else: failure(msg or "got %r, expected %r" % (a, b)) + def assert_deep_equal(a, b, msg=None): try: if len(a) == len(b): - if all([x==y for x,y in zip(a,b)]): + if all([x == y for x, y in zip(a, b)]): success() else: - failure(msg or "got %s, expected %s" % (a,b)) + failure(msg or "got %s, expected %s" % (a, b)) else: failure(msg or "got length %s, expected %s" % (len(a), len(b))) except: - assert_equal(a,b,msg) + assert_equal(a, b, msg) def assert_match(v, pattern, msg=None): @@ -95,8 +101,10 @@ def assert_match(v, pattern, msg=None): else: failure(msg or "got %r, doesn't match pattern %r" % (v, pattern)) + def assert_exception(exc_class, func): - import sys, traceback + import sys + import traceback try: func() except exc_class: @@ -108,8 +116,10 @@ def assert_exception(exc_class, func): else: failure("expected %r exception, got no exception" % exc_class.__name__) + def assert_no_exception(func): - import sys, traceback + import sys + import traceback try: func() except: @@ -118,11 +128,14 @@ def assert_no_exception(func): else: success() + def assert_warning(warn_class, func): # note: this assert calls func three times! import warnings + def warn_error(message, category=UserWarning, **options): raise category(message) + def warn_ignore(message, category=UserWarning, **options): pass warn = warnings.warn @@ -134,22 +147,25 @@ def assert_warning(warn_class, func): warnings.warn = warn_error assert_exception(warn_class, func) finally: - warnings.warn = warn # restore + warnings.warn = warn # restore return result # helpers from io import BytesIO + def fromstring(data): from PIL import Image return Image.open(BytesIO(data)) + def tostring(im, format, **options): out = BytesIO() im.save(out, format, **options) return out.getvalue() + def lena(mode="RGB", cache={}): from PIL import Image im = cache.get(mode) @@ -165,6 +181,7 @@ def lena(mode="RGB", cache={}): cache[mode] = im return im + def assert_image(im, mode, size, msg=None): if mode is not None and im.mode != mode: failure(msg or "got mode %r, expected %r" % (im.mode, mode)) @@ -173,6 +190,7 @@ def assert_image(im, mode, size, msg=None): else: success() + def assert_image_equal(a, b, msg=None): if a.mode != b.mode: failure(msg or "got mode %r, expected %r" % (a.mode, b.mode)) @@ -184,6 +202,7 @@ def assert_image_equal(a, b, msg=None): else: success() + def assert_image_similar(a, b, epsilon, msg=None): epsilon = float(epsilon) if a.mode != b.mode: @@ -193,19 +212,25 @@ def assert_image_similar(a, b, epsilon, msg=None): diff = 0 try: ord(b'0') - for abyte,bbyte in zip(a.tobytes(),b.tobytes()): + for abyte, bbyte in zip(a.tobytes(), b.tobytes()): diff += abs(ord(abyte)-ord(bbyte)) except: - for abyte,bbyte in zip(a.tobytes(),b.tobytes()): + for abyte, bbyte in zip(a.tobytes(), b.tobytes()): diff += abs(abyte-bbyte) ave_diff = float(diff)/(a.size[0]*a.size[1]) if epsilon < ave_diff: - return failure(msg or "average pixel value difference %.4f > epsilon %.4f" %(ave_diff, epsilon)) + return failure( + msg or "average pixel value difference %.4f > epsilon %.4f" % ( + ave_diff, epsilon)) else: return success() + def tempfile(template, *extra): - import os, os.path, sys, tempfile + import os + import os.path + import sys + import tempfile files = [] root = os.path.join(tempfile.gettempdir(), 'pillow-tests') try: @@ -222,18 +247,20 @@ def tempfile(template, *extra): _tempfiles.extend(files) return files[0] + # test runner def run(): global _target, _tests, run - import sys, traceback + import sys + import traceback _target = sys.modules["__main__"] - run = None # no need to run twice + run = None # no need to run twice tests = [] for name, value in list(vars(_target).items()): if name[:5] == "test_" and type(value) is type(success): tests.append((value.__code__.co_firstlineno, name, value)) - tests.sort() # sort by line + tests.sort() # sort by line for lineno, name, func in tests: try: _tests = [] @@ -251,41 +278,49 @@ def run(): sys.argv[0], lineno, v)) failure.count += 1 + def yield_test(function, *args): # collect delayed/generated tests _tests.append((function, args)) + def skip(msg=None): import os print("skip") - os._exit(0) # don't run exit handlers + os._exit(0) # don't run exit handlers + def ignore(pattern): """Tells the driver to ignore messages matching the pattern, for the duration of the current test.""" print('ignore: %s' % pattern) + def _setup(): global _logfile + def report(): if run: run() if success.count and not failure.count: print("ok") # only clean out tempfiles if test passed - import os, os.path, tempfile + import os + import os.path + import tempfile for file in _tempfiles: try: os.remove(file) except OSError: - pass # report? + pass # report? temp_root = os.path.join(tempfile.gettempdir(), 'pillow-tests') try: os.rmdir(temp_root) except OSError: pass - import atexit, sys + import atexit + import sys atexit.register(report) if "--coverage" in sys.argv: import coverage From 9210f88102000fa207dfbbe93516c6f1951d4d80 Mon Sep 17 00:00:00 2001 From: hugovk Date: Tue, 8 Apr 2014 17:20:52 +0300 Subject: [PATCH 16/23] Start coverage measurement earlier so tests are properly covered --- Tests/tester.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/Tests/tester.py b/Tests/tester.py index 510486b1f..5900a7f3a 100644 --- a/Tests/tester.py +++ b/Tests/tester.py @@ -299,6 +299,12 @@ def ignore(pattern): def _setup(): global _logfile + import sys + if "--coverage" in sys.argv: + import coverage + cov = coverage.coverage(auto_data=True, include="PIL/*") + cov.start() + def report(): if run: run() @@ -320,12 +326,8 @@ def _setup(): pass import atexit - import sys atexit.register(report) - if "--coverage" in sys.argv: - import coverage - cov = coverage.coverage(auto_data=True, include="PIL/*") - cov .start() + if "--log" in sys.argv: _logfile = open("test.log", "a") From dd6067dbf4f6e9c9691ec6fcb9e06f8d5122065f Mon Sep 17 00:00:00 2001 From: Hugo Date: Wed, 9 Apr 2014 10:17:20 +0300 Subject: [PATCH 17/23] Coverage badge in README [ci skip] --- README.rst | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.rst b/README.rst index 78a256c0d..cf9039b70 100644 --- a/README.rst +++ b/README.rst @@ -16,4 +16,7 @@ Pillow is the "friendly" PIL fork by Alex Clark and Contributors. PIL is the Pyt :target: https://pypi.python.org/pypi/Pillow/ :alt: Number of PyPI downloads +.. image:: https://coveralls.io/repos/python-imaging/Pillow/badge.png?branch=master + :target: https://coveralls.io/r/python-imaging/Pillow?branch=master + The documentation is hosted at http://pillow.readthedocs.org/. It contains installation instructions, tutorials, reference, compatibility details, and more. From 1cb4bf7c1514c866c28c4b79ec22e885499aaab0 Mon Sep 17 00:00:00 2001 From: Hugo Date: Wed, 9 Apr 2014 10:33:13 +0300 Subject: [PATCH 18/23] SVG Travis, and Coverage badge in docs [ci skip] The SVG badge uses the Shields project for consistency with other projects' badges. More info: http://blog.travis-ci.com/2014-03-20-build-status-badges-support-svg/ --- docs/index.rst | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/docs/index.rst b/docs/index.rst index a59cda115..520addd93 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -4,8 +4,9 @@ Pillow Pillow is the 'friendly' PIL fork by Alex Clark and Contributors. PIL is the Python Imaging Library by Fredrik Lundh and Contributors. -.. image:: https://travis-ci.org/python-imaging/Pillow.png +.. image:: https://travis-ci.org/python-imaging/Pillow.svg?branch=master :target: https://travis-ci.org/python-imaging/Pillow + :alt: GitHub build status .. image:: https://pypip.in/v/Pillow/badge.png :target: https://pypi.python.org/pypi/Pillow/ @@ -15,6 +16,10 @@ Python Imaging Library by Fredrik Lundh and Contributors. :target: https://pypi.python.org/pypi/Pillow/ :alt: Number of PyPI downloads +.. image:: https://coveralls.io/repos/python-imaging/Pillow/badge.png?branch=master + :target: https://coveralls.io/r/python-imaging/Pillow?branch=master + :alt: Test coverage + To start using Pillow, please read the :doc:`installation instructions `. From 0378a89c6455bc67b1bea5f163e9fca649a1f650 Mon Sep 17 00:00:00 2001 From: hugovk Date: Wed, 9 Apr 2014 10:37:03 +0300 Subject: [PATCH 19/23] Use SVG Travis CI badge [ci skip] --- README.rst | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.rst b/README.rst index cf9039b70..277c5d01f 100644 --- a/README.rst +++ b/README.rst @@ -5,8 +5,9 @@ Pillow Pillow is the "friendly" PIL fork by Alex Clark and Contributors. PIL is the Python Imaging Library by Fredrik Lundh and Contributors. -.. image:: https://travis-ci.org/python-imaging/Pillow.png +.. image:: https://travis-ci.org/python-imaging/Pillow.svg?branch=master :target: https://travis-ci.org/python-imaging/Pillow + :alt: Travis CI build status .. image:: https://pypip.in/v/Pillow/badge.png :target: https://pypi.python.org/pypi/Pillow/ From 5a63e77097eaa9b8c331b24c5ae2978a14ce065d Mon Sep 17 00:00:00 2001 From: hugovk Date: Wed, 9 Apr 2014 10:40:16 +0300 Subject: [PATCH 20/23] Fix alt text [ci skip] --- docs/index.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/index.rst b/docs/index.rst index 520addd93..25e9f6b73 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -1,4 +1,4 @@ -Pillow +Pillow ====== Pillow is the 'friendly' PIL fork by Alex Clark and Contributors. PIL is the @@ -6,7 +6,7 @@ Python Imaging Library by Fredrik Lundh and Contributors. .. image:: https://travis-ci.org/python-imaging/Pillow.svg?branch=master :target: https://travis-ci.org/python-imaging/Pillow - :alt: GitHub build status + :alt: Travis CI build status .. image:: https://pypip.in/v/Pillow/badge.png :target: https://pypi.python.org/pypi/Pillow/ @@ -53,7 +53,7 @@ Pillow is a volunteer effort led by Alex Clark. If you can't help with development please consider helping us financially. Your assistance would be very much appreciated! -.. note:: Contributors please add your name and donation preference here. +.. note:: Contributors please add your name and donation preference here. ======================================= ======================================= **Developer** **Preference** From 267cdf523eb1280f247e95dfb48949d870b7f18c Mon Sep 17 00:00:00 2001 From: hugovk Date: Fri, 11 Apr 2014 10:28:06 +0300 Subject: [PATCH 21/23] Print out lists of failed tests (and temporarily force a failure for testing) --- Tests/run.py | 31 ++++++++++++++++++++----------- Tests/test_mode_i16.py | 8 ++++++-- 2 files changed, 26 insertions(+), 13 deletions(-) diff --git a/Tests/run.py b/Tests/run.py index 01a3f3603..57fc5245d 100644 --- a/Tests/run.py +++ b/Tests/run.py @@ -2,7 +2,12 @@ from __future__ import print_function # minimal test runner -import glob, os, os.path, sys, tempfile, re +import glob +import os +import os.path +import re +import sys +import tempfile try: root = os.path.dirname(__file__) @@ -34,6 +39,7 @@ files.sort() success = failure = 0 include = [x for x in sys.argv[1:] if x[:2] != "--"] skipped = [] +failed = [] python_options = " ".join(python_options) tester_options = " ".join(tester_options) @@ -48,8 +54,8 @@ for file in files: # 2>&1 works on unix and on modern windowses. we might care about # very old Python versions, but not ancient microsoft products :-) out = os.popen("%s %s -u %s %s 2>&1" % ( - sys.executable, python_options, file, tester_options - )) + sys.executable, python_options, file, tester_options + )) result = out.read() # Extract any ignore patterns @@ -63,7 +69,7 @@ for file in files: if not p.endswith('$'): p = p + '$' return p - + ignore_res = [re.compile(fix_re(p), re.MULTILINE) for p in ignore_pats] except: print('(bad ignore patterns %r)' % ignore_pats) @@ -73,11 +79,11 @@ for file in files: result = r.sub('', result) result = result.strip() - + if result == "ok": result = None elif result == "skip": - print("---", "skipped") # FIXME: driver should include a reason + print("---", "skipped") # FIXME: driver should include a reason skipped.append(test) continue elif not result: @@ -91,7 +97,7 @@ for file in files: # if there's an ok at the end, it's not really ok result = result[:-3] print(result) - failure = failure + 1 + failed.append[test] else: success = success + 1 @@ -105,6 +111,7 @@ if tempfiles: print(file) print("-"*68) + def tests(n): if n == 1: return "1 test" @@ -112,10 +119,12 @@ def tests(n): return "%d tests" % n if skipped: - print("---", tests(len(skipped)), "skipped.") - print(skipped) -if failure: - print("***", tests(failure), "of", (success + failure), "failed.") + print("---", tests(len(skipped)), "skipped:") + print(", ".join(skipped)) +if failed: + failure = len(failed) + print("***", tests(failure), "of", (success + failure), "failed:") + print(", ".join(failed)) sys.exit(1) else: print(tests(success), "passed.") diff --git a/Tests/test_mode_i16.py b/Tests/test_mode_i16.py index 4c1798509..2130ee3f6 100644 --- a/Tests/test_mode_i16.py +++ b/Tests/test_mode_i16.py @@ -2,6 +2,7 @@ from tester import * from PIL import Image + def verify(im1): im2 = lena("I") assert_equal(im1.size, im2.size) @@ -18,6 +19,7 @@ def verify(im1): return success() + def test_basic(): # PIL 1.1 has limited support for 16-bit image data. Check that # create/copy/transform and save works as expected. @@ -30,10 +32,10 @@ def test_basic(): w, h = imIn.size imOut = imIn.copy() - verify(imOut) # copy + verify(imOut) # copy imOut = imIn.transform((w, h), Image.EXTENT, (0, 0, w, h)) - verify(imOut) # transform + verify(imOut) # transform filename = tempfile("temp.im") imIn.save(filename) @@ -103,3 +105,5 @@ def test_convert(): verify(im.convert("I;16B")) verify(im.convert("I;16B").convert("L")) verify(im.convert("I;16B").convert("I")) + + assert(False) # TEMP FOR TESTING! From cf6daf03fedaa5a63172733394d8d023230c844d Mon Sep 17 00:00:00 2001 From: hugovk Date: Fri, 11 Apr 2014 10:47:37 +0300 Subject: [PATCH 22/23] Use correct brackets --- Tests/run.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Tests/run.py b/Tests/run.py index 57fc5245d..4dccc005a 100644 --- a/Tests/run.py +++ b/Tests/run.py @@ -97,7 +97,7 @@ for file in files: # if there's an ok at the end, it's not really ok result = result[:-3] print(result) - failed.append[test] + failed.append(test) else: success = success + 1 From 9c6b07d21b84c66df7cc168a95e93da2721b9873 Mon Sep 17 00:00:00 2001 From: hugovk Date: Fri, 11 Apr 2014 10:59:58 +0300 Subject: [PATCH 23/23] Remove temporary forced failure --- Tests/test_mode_i16.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/Tests/test_mode_i16.py b/Tests/test_mode_i16.py index 2130ee3f6..782a26623 100644 --- a/Tests/test_mode_i16.py +++ b/Tests/test_mode_i16.py @@ -105,5 +105,3 @@ def test_convert(): verify(im.convert("I;16B")) verify(im.convert("I;16B").convert("L")) verify(im.convert("I;16B").convert("I")) - - assert(False) # TEMP FOR TESTING!