Merge branch 'pr/187'

This commit is contained in:
Simon Conseil
2016-01-08 00:45:07 +01:00
4 changed files with 18 additions and 4 deletions

View File

@@ -36,6 +36,7 @@ import PIL
import pilkit.processors
import sys
import warnings
import fractions
from copy import deepcopy
from datetime import datetime
@@ -254,7 +255,8 @@ def get_exif_tags(data):
exptime = data['ExposureTime']
if isinstance(exptime, tuple):
try:
simple['exposure'] = exptime[0] / float(exptime[1])
simple['exposure'] = str(fractions.Fraction(exptime[0],
exptime[1]))
except IndexError:
# Pillow == 3.0
simple['exposure'] = exptime[0]

View File

@@ -1,6 +1,7 @@
# -*- coding: utf-8 -*-
import os
import PIL
import pytest
from sigal.settings import read_settings
@@ -12,3 +13,7 @@ CURRENT_DIR = os.path.abspath(os.path.dirname(__file__))
def settings():
"""Read the sample config file."""
return read_settings(os.path.join(CURRENT_DIR, 'sample', 'sigal.conf.py'))
def pytest_report_header(config):
return "project deps: Pillow-{}".format(PIL.PILLOW_VERSION)

View File

@@ -1,6 +1,7 @@
# -*- coding:utf-8 -*-
import os
import PIL
import pytest
from PIL import Image
@@ -104,7 +105,10 @@ def test_get_exif_tags():
assert simple['iso'] == 50
assert simple['Make'] == 'NIKON'
assert simple['datetime'] == 'Sunday, 22. January 2006'
assert simple['exposure'] == 0.00100603
if PIL.PILLOW_VERSION == '3.0.0':
assert simple['exposure'] == 0.00100603
else:
assert simple['exposure'] == '100603/100000000'
data = {'FNumber': [1, 0], 'FocalLength': [1, 0], 'ExposureTime': 10}
simple = get_exif_tags(data)
@@ -142,7 +146,8 @@ def test_exif_copy(tmpdir):
assert not simple
@pytest.mark.xfail
@pytest.mark.xfail(PIL.PILLOW_VERSION == '3.0.0',
reason="Pillow 3.0.0 was broken")
def test_exif_gps(tmpdir):
"""Test reading out correct geo tags"""

View File

@@ -1,9 +1,11 @@
[tox]
envlist = py27,py33,py34,py35,report,check
envlist = py{27,33,34,35}-pillow{30,31},report,check
[testenv]
commands = py.test --cov sigal --cov-report term-missing
deps =
pillow30: Pillow==3.0.0
pillow31: Pillow>3.0.0
pytest
pytest-capturelog
pytest-cov