14
0
forked from pool/python-pilkit

Accepting request 1115887 from devel:languages:python

OBS-URL: https://build.opensuse.org/request/show/1115887
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/python-pilkit?expand=0&rev=7
This commit is contained in:
2023-10-06 19:13:59 +00:00
committed by Git OBS Bridge
7 changed files with 25 additions and 144 deletions

View File

@@ -1,13 +0,0 @@
Index: pilkit-2.0/tests/test_utils.py
===================================================================
--- pilkit-2.0.orig/tests/test_utils.py
+++ pilkit-2.0/tests/test_utils.py
@@ -16,7 +16,7 @@ def test_extension_to_format():
def test_format_to_extension_no_init():
- eq_(format_to_extension('PNG'), '.png')
+ eq_(format_to_extension('GIF'), '.gif')
eq_(format_to_extension('ICO'), '.ico')

View File

@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:ddb30c2f0198a147e56b151476c3bb9fe045fbfd5b0a0fa2a3148dba62d1559f
size 161137

3
pilkit-3.0.tar.gz Normal file
View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:f6719e8cc0482e5447f5cb94f18b949d8e604ea9673a9b019c74d41b779e4eab
size 402342

View File

@@ -1,26 +0,0 @@
Index: pilkit-2.0/tests/test_processors.py
===================================================================
--- pilkit-2.0.orig/tests/test_processors.py
+++ pilkit-2.0/tests/test_processors.py
@@ -4,7 +4,7 @@ from pilkit.processors import (Resize, R
import os
from pilkit.processors.resize import Thumbnail
from .utils import create_image, eq_, assert_true
-import mock
+import unittest.mock as mock
def test_smartcrop():
Index: pilkit-2.0/tests/test_utils.py
===================================================================
--- pilkit-2.0.orig/tests/test_utils.py
+++ pilkit-2.0/tests/test_utils.py
@@ -5,7 +5,7 @@ from pilkit.lib import Image
from pilkit.utils import (extension_to_format, format_to_extension, FileWrapper,
save_image, prepare_image, quiet)
from pytest import raises
-from mock import Mock, patch
+from unittest.mock import Mock, patch
from tempfile import NamedTemporaryFile
from .utils import create_image, eq_, assert_true

View File

@@ -1,3 +1,19 @@
-------------------------------------------------------------------
Thu Oct 5 08:36:31 UTC 2023 - Markéta Machová <mmachova@suse.com>
- Update to 3.0
* Create Convert processor and GaussianBlur processor
* Updating histogram entropy implementations
* Make processors.Resize more memory-efficient
* Added WebP as a transparency format
* Use pytest instead of nose
* Make it compatible with Pillow10
* test: use unittest.mock instead of mock
- Drop merged patches:
* switch-to-pytest.patch
* python-pilkit-no-mock.patch
* pil-fix-test.patch
-------------------------------------------------------------------
Wed Apr 6 10:37:26 UTC 2022 - pgajdos@suse.com

View File

@@ -1,7 +1,7 @@
#
# spec file for package python-pilkit
#
# Copyright (c) 2022 SUSE LLC
# Copyright (c) 2023 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@@ -16,18 +16,14 @@
#
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
%{?sle15_python_module_pythons}
Name: python-pilkit
Version: 2.0
Version: 3.0
Release: 0
Summary: A collection of utilities and processors for the Python Imaging Libary
License: BSD-3-Clause
URL: https://github.com/matthewwithanm/pilkit/
Source: https://files.pythonhosted.org/packages/source/p/pilkit/pilkit-%{version}.tar.gz
Patch0: pil-fix-test.patch
Patch1: switch-to-pytest.patch
# https://github.com/matthewwithanm/pilkit/issues/54
Patch2: python-pilkit-no-mock.patch
BuildRequires: %{python_module setuptools}
BuildRequires: fdupes
BuildRequires: python-rpm-macros
@@ -36,6 +32,7 @@ BuildArch: noarch
BuildRequires: %{python_module Pillow}
BuildRequires: %{python_module pytest}
# /SECTION
Requires: python-Pillow
%python_subpackages
%description
@@ -62,6 +59,7 @@ interface for performing manipulations on PIL images.
%files %{python_files}
%license LICENSE
%doc AUTHORS README.rst
%{python_sitelib}/*
%{python_sitelib}/pilkit
%{python_sitelib}/pilkit-%{version}*-info
%changelog

View File

@@ -1,94 +0,0 @@
Index: pilkit-2.0/tests/test_processors.py
===================================================================
--- pilkit-2.0.orig/tests/test_processors.py
+++ pilkit-2.0/tests/test_processors.py
@@ -1,10 +1,9 @@
from pilkit.lib import Image, ImageDraw, ImageColor
from pilkit.processors import (Resize, ResizeToFill, ResizeToFit, SmartCrop,
SmartResize, MakeOpaque, ColorOverlay)
-from nose.tools import eq_, assert_true
import os
from pilkit.processors.resize import Thumbnail
-from .utils import create_image
+from .utils import create_image, eq_, assert_true
import mock
Index: pilkit-2.0/tests/test_utils.py
===================================================================
--- pilkit-2.0.orig/tests/test_utils.py
+++ pilkit-2.0/tests/test_utils.py
@@ -4,10 +4,10 @@ from pilkit.exceptions import UnknownFor
from pilkit.lib import Image
from pilkit.utils import (extension_to_format, format_to_extension, FileWrapper,
save_image, prepare_image, quiet)
+from pytest import raises
from mock import Mock, patch
-from nose.tools import eq_, raises, ok_
from tempfile import NamedTemporaryFile
-from .utils import create_image
+from .utils import create_image, eq_, assert_true
def test_extension_to_format():
@@ -20,14 +20,14 @@ def test_format_to_extension_no_init():
eq_(format_to_extension('ICO'), '.ico')
-@raises(UnknownFormat)
def test_unknown_format():
- format_to_extension('TXT')
+ with raises(UnknownFormat):
+ format_to_extension('TXT')
-@raises(UnknownExtension)
def test_unknown_extension():
- extension_to_format('.txt')
+ with raises(UnknownExtension):
+ extension_to_format('.txt')
def test_default_extension():
@@ -43,14 +43,13 @@ def test_default_extension():
eq_(format_to_extension('JPEG'), '.jpg')
-@raises(AttributeError)
def test_filewrapper():
class K(object):
def fileno(self):
raise UnsupportedOperation
-
- FileWrapper(K()).fileno()
+ with raises(AttributeError):
+ FileWrapper(K()).fileno()
def test_save_with_filename():
@@ -71,7 +70,7 @@ def test_format_normalization():
See https://github.com/matthewwithanm/django-imagekit/issues/262
"""
im = Image.new('RGBA', (100, 100))
- ok_('transparency' in prepare_image(im, 'gIF')[1])
+ assert_true('transparency' in prepare_image(im, 'gIF')[1])
def test_quiet():
"""
Index: pilkit-2.0/tests/utils.py
===================================================================
--- pilkit-2.0.orig/tests/utils.py
+++ pilkit-2.0/tests/utils.py
@@ -17,3 +17,11 @@ def get_image_file():
def create_image():
return Image.open(get_image_file())
+
+
+def eq_(first, second):
+ assert first == second
+
+
+def assert_true(first):
+ assert first is True