Skip to content

Commit

Permalink
Updates to support Pillow, DRF & Django increments.
Browse files Browse the repository at this point in the history
  • Loading branch information
respondcreate committed Oct 29, 2019
1 parent d41e279 commit fb28bfc
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 35 deletions.
6 changes: 5 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,11 @@ matrix:
- python: "3.7"
dist: xenial
sudo: required
env: DJANGO_VERSION=2.1.1 REST_FRAMEWORK_VERSION=3.8.2
env: DJANGO_VERSION=2.1.13 REST_FRAMEWORK_VERSION=3.8.2
- python: "3.7"
dist: xenial
sudo: required
env: DJANGO_VERSION=2.2.6 REST_FRAMEWORK_VERSION=3.10.3
before_install:
- export DJANGO_SETTINGS_MODULE=tests.test_settings
# Tell it the things it will need to install when it boots
Expand Down
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
setup(
name='django-versatileimagefield',
packages=find_packages(),
version='1.10',
version='1.11',
author=u'Jonathan Ellenberger',
author_email='jonathan_ellenberger@wgbh.org',
url='http://github.com/respondcreate/django-versatileimagefield/',
Expand All @@ -15,7 +15,7 @@
"creating new images from the one assigned to the field.",
long_description=open('README.rst').read(),
zip_safe=False,
install_requires=['Pillow>=2.4.0,<6.0.0'],
install_requires=['Pillow>=2.4.0,<6.2.0'],
include_package_data=True,
keywords=[
'django',
Expand Down
6 changes: 3 additions & 3 deletions test_reqs.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
Django==2.1.1
Pillow==5.0.0
Django==2.2.6
Pillow>=6.2.0
Sphinx==1.2.3
coverage==3.7.1
coveralls==0.5
djangorestframework==3.7.7
djangorestframework==3.10.3
flake8==2.2.5
requests==2.5.1
sphinx-rtd-theme==0.1.6
29 changes: 0 additions & 29 deletions tests/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,35 +176,6 @@ def test_field_can_be_null(self):
obj = MaybeVersatileImageModel(pk=34, name='foo')
obj.save()

def test_storage_fails_to_return_url(self):
"""
This is a wonky test used to ensure 100% code coverge in utils.py.
We need to test that a storage.url call can hit an exception to trigger
resized_url = None in try/except
"""
import types
from copy import deepcopy
from django.utils.six import BytesIO

def storage_url_fail(self, path):
if self.exists(path):
return path

raise Exception("Storage class returns exception because file does not exist.")

class SizedImageSubclass(SizedImage):
filename_key = 'test'

def process_image(self, image, image_format, save_kwargs, width, height):
return BytesIO()

_storage = deepcopy(self.jpg.image.field.storage)
_storage.url = types.MethodType(storage_url_fail, _storage)

s = SizedImageSubclass(self.jpg.image.name, _storage, True)
s['100x100']

def test_check_storage_paths(self):
"""Ensure storage paths are properly set."""
self.assertEqual(self.jpg.image.name, 'python-logo.jpg')
Expand Down

0 comments on commit fb28bfc

Please sign in to comment.