forked from pool/python-pilkit
- 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
This commit is contained in:
94
switch-to-pytest.patch
Normal file
94
switch-to-pytest.patch
Normal file
@@ -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
|
||||
Reference in New Issue
Block a user