From 6e79cc00ffa630752414d79c145e783f610e8ee0 Mon Sep 17 00:00:00 2001 From: wiredfool Date: Thu, 19 Jun 2014 05:55:34 -0700 Subject: [PATCH 1/2] test runner for installed versions of pillow --- test-installed.py | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100755 test-installed.py diff --git a/test-installed.py b/test-installed.py new file mode 100755 index 000000000..7f58f4966 --- /dev/null +++ b/test-installed.py @@ -0,0 +1,24 @@ +#!/usr/bin/env python +import nose +import os +import sys +import glob + +# 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__': + nose.main() From 0b0ec8b40faba37bbd937391aaa0cb1ef294ce9f Mon Sep 17 00:00:00 2001 From: wiredfool Date: Thu, 19 Jun 2014 06:06:23 -0700 Subject: [PATCH 2/2] Proper skipping of tests when lcms2 is not installed --- Tests/test_imagecms.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Tests/test_imagecms.py b/Tests/test_imagecms.py index d4432d9be..f3f0791e5 100644 --- a/Tests/test_imagecms.py +++ b/Tests/test_imagecms.py @@ -18,6 +18,8 @@ class TestImageCms(PillowTestCase): def setUp(self): try: from PIL import ImageCms + # need to hit getattr to trigger the delayed import error + ImageCms.core.profile_open except ImportError as v: self.skipTest(v)