This commit is contained in:
Hugo 2017-12-19 17:16:15 +02:00
parent 8adab0ec0d
commit 070e66fe7b

View File

@ -20,6 +20,7 @@ try:
except ImportError: except ImportError:
pass pass
def convert_to_comparable(a, b): def convert_to_comparable(a, b):
new_a, new_b = a, b new_a, new_b = a, b
if a.mode == 'P': if a.mode == 'P':
@ -97,7 +98,7 @@ class PillowTestCase(unittest.TestCase):
if HAS_UPLOADER: if HAS_UPLOADER:
try: try:
url = test_image_results.upload(a, b) url = test_image_results.upload(a, b)
logger.error("Url for test images: %s" %url) logger.error("Url for test images: %s" % url)
except: except:
pass pass
@ -130,7 +131,7 @@ class PillowTestCase(unittest.TestCase):
if HAS_UPLOADER: if HAS_UPLOADER:
try: try:
url = test_image_results.upload(a, b) url = test_image_results.upload(a, b)
logger.error("Url for test images: %s" %url) logger.error("Url for test images: %s" % url)
except: except:
pass pass
raise e raise e
@ -207,11 +208,12 @@ class PillowTestCase(unittest.TestCase):
return Image.open(outfile) return Image.open(outfile)
raise IOError() raise IOError()
@unittest.skipIf(sys.platform.startswith('win32'), "requires Unix or MacOS") @unittest.skipIf(sys.platform.startswith('win32'), "requires Unix or MacOS")
class PillowLeakTestCase(PillowTestCase): class PillowLeakTestCase(PillowTestCase):
# requires unix/osx # requires unix/osx
iterations = 100 # count iterations = 100 # count
mem_limit = 512 # k mem_limit = 512 # k
def _get_mem_usage(self): def _get_mem_usage(self):
""" """
@ -221,7 +223,7 @@ class PillowLeakTestCase(PillowTestCase):
:returns; memory usage in kilobytes :returns; memory usage in kilobytes
""" """
from resource import getpagesize, getrusage, RUSAGE_SELF from resource import getrusage, RUSAGE_SELF
mem = getrusage(RUSAGE_SELF).ru_maxrss mem = getrusage(RUSAGE_SELF).ru_maxrss
if sys.platform == 'darwin': if sys.platform == 'darwin':
# man 2 getrusage: # man 2 getrusage:
@ -315,6 +317,7 @@ def imagemagick_available():
def on_appveyor(): def on_appveyor():
return 'APPVEYOR' in os.environ return 'APPVEYOR' in os.environ
if sys.platform == 'win32': if sys.platform == 'win32':
IMCONVERT = os.environ.get('MAGICK_HOME', '') IMCONVERT = os.environ.get('MAGICK_HOME', '')
if IMCONVERT: if IMCONVERT: