2014-07-01 06:19:09 +04:00
|
|
|
import sys
|
|
|
|
|
2014-08-28 15:44:19 +04:00
|
|
|
from helper import unittest, PillowTestCase
|
2013-12-05 08:59:33 +04:00
|
|
|
|
|
|
|
# This test is not run automatically.
|
|
|
|
#
|
|
|
|
# It requires > 2gb memory for the >2 gigapixel image generated in the
|
|
|
|
# second test. Running this automatically would amount to a denial of
|
|
|
|
# service on our testing infrastructure. I expect this test to fail
|
2015-10-14 16:49:03 +03:00
|
|
|
# on any 32-bit machine, as well as any smallish things (like
|
2014-06-25 13:32:52 +04:00
|
|
|
# Raspberry Pis). It does succeed on a 3gb Ubuntu 12.04x64 VM on Python
|
2016-02-09 14:02:43 +03:00
|
|
|
# 2.7 and 3.2.
|
2013-12-05 08:59:33 +04:00
|
|
|
|
|
|
|
from PIL import Image
|
2014-06-25 13:32:52 +04:00
|
|
|
YDIM = 32769
|
|
|
|
XDIM = 48000
|
|
|
|
|
|
|
|
|
2015-10-14 16:49:03 +03:00
|
|
|
@unittest.skipIf(sys.maxsize <= 2**32, "requires 64-bit system")
|
2014-06-25 13:43:01 +04:00
|
|
|
class LargeMemoryTest(PillowTestCase):
|
2014-06-25 13:32:52 +04:00
|
|
|
|
2014-06-25 20:27:43 +04:00
|
|
|
def _write_png(self, xdim, ydim):
|
2014-06-25 13:32:52 +04:00
|
|
|
f = self.tempfile('temp.png')
|
2018-10-02 11:55:28 +03:00
|
|
|
im = Image.new('L', (xdim, ydim), 0)
|
2014-06-25 13:32:52 +04:00
|
|
|
im.save(f)
|
|
|
|
|
|
|
|
def test_large(self):
|
|
|
|
""" succeeded prepatch"""
|
|
|
|
self._write_png(XDIM, YDIM)
|
|
|
|
|
|
|
|
def test_2gpx(self):
|
|
|
|
"""failed prepatch"""
|
2014-06-25 20:27:43 +04:00
|
|
|
self._write_png(XDIM, XDIM)
|
2014-06-25 13:32:52 +04:00
|
|
|
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
|
unittest.main()
|