Moved resource import to inside the function

This commit is contained in:
Josh Ware 2014-08-26 13:43:11 +10:00 committed by wiredfool
parent 3acb06e9d2
commit c134e5ab45

View File

@ -2,7 +2,6 @@ from helper import unittest, PillowTestCase, tearDownModule
import sys import sys
from PIL import Image from PIL import Image
from resource import setrlimit, RLIMIT_AS, RLIMIT_STACK
# Limits for testing the leak # Limits for testing the leak
mem_limit = 512*1048576 mem_limit = 512*1048576
@ -18,6 +17,7 @@ class TestJp2kLeak(PillowTestCase):
self.skipTest('JPEG 2000 support not available') self.skipTest('JPEG 2000 support not available')
def test_leak(self): def test_leak(self):
from resource import setrlimit, RLIMIT_AS, RLIMIT_STACK
setrlimit(RLIMIT_STACK, (stack_size, stack_size)) setrlimit(RLIMIT_STACK, (stack_size, stack_size))
setrlimit(RLIMIT_AS, (mem_limit, mem_limit)) setrlimit(RLIMIT_AS, (mem_limit, mem_limit))
for count in range(iterations): for count in range(iterations):