From 492da55af08224160d0e652cbba0ff9444c346a9 Mon Sep 17 00:00:00 2001 From: John Evans Date: Tue, 16 Jul 2013 16:41:33 -0400 Subject: [PATCH 1/3] Moving test requirements into its own area. Worked on Fedora19, python 2.7. #51 --- setup.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/setup.py b/setup.py index b4379c2..ace8f9c 100644 --- a/setup.py +++ b/setup.py @@ -13,17 +13,22 @@ kwargs = {'name': 'Glymur', 'package_data': {'glymur': ['data/*.jp2', 'data/*.j2k']}, 'scripts': ['bin/jp2dump'], 'license': 'LICENSE.txt', + 'test_suite': 'glymur.test', 'platforms': ['darwin']} instllrqrs = ['numpy>1.6.2'] if sys.hexversion < 0x03030000: instllrqrs.append('contextlib2>=0.4') - instllrqrs.append('mock>=1.0.1') if sys.hexversion < 0x02070000: instllrqrs.append('ordereddict>=1.1') instllrqrs.append('unittest2>=0.5.1') kwargs['install_requires'] = instllrqrs +testrqrs = ['matplotlib>=1.1.0', 'Pillow>=2.0.0'] +if sys.hexversion < 0x03030000: + testrqrs.append('mock>=1.0.1') +kwargs['tests_require'] = testrqrs + clssfrs = ["Programming Language :: Python", "Programming Language :: Python :: 2.6", "Programming Language :: Python :: 2.7", From fa08fc06709b5e27d93ae50bc6fad5fc850e30b0 Mon Sep 17 00:00:00 2001 From: John Evans Date: Tue, 16 Jul 2013 18:26:53 -0400 Subject: [PATCH 2/3] Not going to bother with a test_requires section. Closes #51. Numpy causes trouble on the mac with test_requires. Anyway, the only real hard requirement is "mock" with 2.6 and 2.7, and that's hardly worth the extra trouble. matplotlib and pillow are optional requirements. --- setup.py | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/setup.py b/setup.py index ace8f9c..6a950dc 100644 --- a/setup.py +++ b/setup.py @@ -16,19 +16,15 @@ kwargs = {'name': 'Glymur', 'test_suite': 'glymur.test', 'platforms': ['darwin']} -instllrqrs = ['numpy>1.6.2'] +instllrqrs = ['numpy>=1.4.1'] if sys.hexversion < 0x03030000: instllrqrs.append('contextlib2>=0.4') + instllrqrs.append('mock>=1.0.1') if sys.hexversion < 0x02070000: instllrqrs.append('ordereddict>=1.1') instllrqrs.append('unittest2>=0.5.1') kwargs['install_requires'] = instllrqrs -testrqrs = ['matplotlib>=1.1.0', 'Pillow>=2.0.0'] -if sys.hexversion < 0x03030000: - testrqrs.append('mock>=1.0.1') -kwargs['tests_require'] = testrqrs - clssfrs = ["Programming Language :: Python", "Programming Language :: Python :: 2.6", "Programming Language :: Python :: 2.7", From a1c779b72943706ddd47402e948b641677ffa65a Mon Sep 17 00:00:00 2001 From: John Evans Date: Tue, 16 Jul 2013 18:45:25 -0400 Subject: [PATCH 3/3] Simplified test requirements, dropping scikit-image and freeimage. closes #51 --- docs/source/detailed_installation.rst | 32 ++++++++------------------- glymur/test/test_opj_suite_neg.py | 25 +++++---------------- glymur/test/test_opj_suite_write.py | 25 +++++---------------- 3 files changed, 19 insertions(+), 63 deletions(-) diff --git a/docs/source/detailed_installation.rst b/docs/source/detailed_installation.rst index d05dae4..f015612 100644 --- a/docs/source/detailed_installation.rst +++ b/docs/source/detailed_installation.rst @@ -56,17 +56,13 @@ packages/RPMs/ports/whatever without going through pip. Mac OS X -------- All the necessary packages are available to use glymur with Python 3.3 via -MacPorts. A minimal set of ports includes +MacPorts. You should install the following set of ports: * python33 * py33-numpy * py33-distribute - -To run all the testing, one of the following combinations of ports must -additionally be installed: - - * py33-scikit-image and either py33-Pillow or freeimage - * py33-matplotlib and py33-Pillow + * py33-matplotlib (optional, for running certain tests) + * py33-Pillow (optional, for running certain tests) MacPorts supplies both OpenJPEG 1.5.0 and OpenJPEG 2.0.0. As previously mentioned, the 2.0.0 official release is not supported (although the 2.0+ @@ -98,15 +94,9 @@ meet the minimal set of requirements for running glymur. * python3-matplotlib (for running tests) * python3-matplotlib-tk (or whichever matplotlib backend you prefer) -A few tests still will not run, however, unless one of the following -combinations of RPMs / Python packages is installed. - - * scikit-image and either Pillow or freeimage - * matplotlib and Pillow - -The 2nd route is probably the easiest, so go ahead and install Pillow -via pip since Pillow is not yet available in Fedora 18 default -repositories:: +Pillow is also needed in order to run the maximum number of tests, so +go ahead and install Pillow via pip since Pillow is not yet available +in Fedora 18 default repositories:: $ yum install python3-devel # pip needs this in order to compile Pillow $ yum install python3-pip @@ -115,8 +105,7 @@ repositories:: Fedora 17 ''''''''' -Fedora 17 ships with Python 3.2 and 2.7, but OpenJPEG is only at version 1.4, -so these steps detail working with Python 2.7 and the svn version of OpenJPEG. +Fedora 17 ships with Python 2.7 and OpenJPEG 1.4. Required RPMs include:: @@ -137,11 +126,8 @@ combinations of RPMs / Python packages is installed. scikit-image was not available in the Fedora 17 default repositories, but it was installable via pip:: - $ yum install Cython # pip needs this in order to compile scikit-image - $ yum install python-devel # pip needs this in order to compile scikit-image - $ yum install freeimage # scikit-image uses this as a backend - $ yum install scipy # needed by scikit-image - $ pip-python install scikit-image --user + $ yum install python-devel # pip needs this in order to compile Pillow + $ pip-python3 install Pillow --user $ pip-python install contextlib2 --user $ export PYTHONPATH=$HOME/.local/lib/python2.7/site-packages:$PYTHONPATH diff --git a/glymur/test/test_opj_suite_neg.py b/glymur/test/test_opj_suite_neg.py index 0ab82ce..17962f7 100644 --- a/glymur/test/test_opj_suite_neg.py +++ b/glymur/test/test_opj_suite_neg.py @@ -19,30 +19,15 @@ import pkg_resources from glymur.lib import openjp2 as opj2 -# Need some combination of matplotlib, PIL, or scikits-image for reading -# other image formats. -no_read_backend = True -msg = "Either scikit-image with the freeimage backend or matplotlib " -msg += "with the PIL backend must be available in order to run the " +msg = "Matplotlib with the PIL backend must be available in order to run the " msg += "tests in this suite." no_read_backend_msg = msg try: - import skimage.io - try: - skimage.io.use_plugin('freeimage') - from skimage.io import imread - no_read_backend = False - except RuntimeError: - skimage.io.use_plugin('PIL') - from skimage.io import imread - no_read_backend = False + from PIL import Image + from matplotlib.pyplot import imread + no_read_backend = False except: - try: - from PIL import Image - from matplotlib.pyplot import imread - no_read_backend = False - except: - pass + no_read_backend = True from glymur import Jp2k import glymur diff --git a/glymur/test/test_opj_suite_write.py b/glymur/test/test_opj_suite_write.py index dbb2282..e5be51a 100644 --- a/glymur/test/test_opj_suite_write.py +++ b/glymur/test/test_opj_suite_write.py @@ -19,30 +19,15 @@ import numpy as np from glymur.lib import openjp2 as opj2 -# Need some combination of matplotlib, PIL, or scikits-image for reading -# other image formats. -no_read_backend = True -msg = "Either scikit-image with the freeimage backend or matplotlib " -msg += "with the PIL backend must be available in order to run the " +msg = "Matplotlib with the PIL backend must be available in order to run the " msg += "tests in this suite." no_read_backend_msg = msg try: - import skimage.io - try: - skimage.io.use_plugin('freeimage') - from skimage.io import imread - no_read_backend = False - except RuntimeError: - skimage.io.use_plugin('PIL') - from skimage.io import imread - no_read_backend = False + from PIL import Image + from matplotlib.pyplot import imread + no_read_backend = False except: - try: - from PIL import Image - from matplotlib.pyplot import imread - no_read_backend = False - except: - pass + no_read_backend = True from glymur import Jp2k import glymur