From 40abb35419f6ba65256fb3d36d8d0063f31b199fd5673d8036bb8a52c917b10c Mon Sep 17 00:00:00 2001 From: Steve Kowalik Date: Mon, 6 Sep 2021 08:45:12 +0000 Subject: [PATCH] - Add switch-to-pytest.patch: * Switch to using pytest, rather than nose. OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-pilkit?expand=0&rev=10 --- python-pilkit.changes | 6 +++ python-pilkit.spec | 8 ++-- switch-to-pytest.patch | 94 ++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 103 insertions(+), 5 deletions(-) create mode 100644 switch-to-pytest.patch diff --git a/python-pilkit.changes b/python-pilkit.changes index a349d53..bbb37ba 100644 --- a/python-pilkit.changes +++ b/python-pilkit.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Mon Sep 6 08:44:11 UTC 2021 - Steve Kowalik + +- Add switch-to-pytest.patch: + * Switch to using pytest, rather than nose. + ------------------------------------------------------------------- Tue Jun 1 08:51:39 UTC 2021 - pgajdos@suse.com diff --git a/python-pilkit.spec b/python-pilkit.spec index b1b1a80..4349961 100644 --- a/python-pilkit.spec +++ b/python-pilkit.spec @@ -22,11 +22,10 @@ Version: 2.0 Release: 0 Summary: A collection of utilities and processors for the Python Imaging Libary License: BSD-3-Clause -Group: Development/Languages/Python URL: https://github.com/matthewwithanm/pilkit/ Source: https://files.pythonhosted.org/packages/source/p/pilkit/pilkit-%{version}.tar.gz Patch0: pil-fix-test.patch -BuildRequires: %{python_module pytest} +Patch1: switch-to-pytest.patch BuildRequires: %{python_module setuptools} BuildRequires: fdupes BuildRequires: python-rpm-macros @@ -34,8 +33,7 @@ BuildArch: noarch # SECTION test requirements BuildRequires: %{python_module Pillow} BuildRequires: %{python_module mock >= 1.0.1} -BuildRequires: %{python_module nose >= 1.3.6} -BuildRequires: %{python_module nose-progressive >= 1.5.1} +BuildRequires: %{python_module pytest} # /SECTION %python_subpackages @@ -48,7 +46,7 @@ interface for performing manipulations on PIL images. %prep %setup -q -n pilkit-%{version} -%patch0 -p1 +%autopatch -p1 %build %python_build diff --git a/switch-to-pytest.patch b/switch-to-pytest.patch new file mode 100644 index 0000000..feb614b --- /dev/null +++ b/switch-to-pytest.patch @@ -0,0 +1,94 @@ +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