summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_bigmem.py
diff options
context:
space:
mode:
authorAntoine Pitrou <solipsis@pitrou.net>2011-01-14 20:19:57 (GMT)
committerAntoine Pitrou <solipsis@pitrou.net>2011-01-14 20:19:57 (GMT)
commit78ae1fb1b94c0f614fd01ba5693aaaead3d4699d (patch)
tree37a6f262d75972ba67a723f72c5a0f6d6e2ceeb8 /Lib/test/test_bigmem.py
parent39be2a5210aa0be61c782aa2222ae8d018ea170f (diff)
downloadcpython-78ae1fb1b94c0f614fd01ba5693aaaead3d4699d.zip
cpython-78ae1fb1b94c0f614fd01ba5693aaaead3d4699d.tar.gz
cpython-78ae1fb1b94c0f614fd01ba5693aaaead3d4699d.tar.bz2
Merged revisions 87968,87971-87975 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k ........ r87968 | antoine.pitrou | 2011-01-12 21:46:37 +0100 (mer., 12 janv. 2011) | 4 lines Fix the expected memory use of utf-8 encoding. Also, release the one reference to a huge object even when an exception is raised. ........ r87971 | antoine.pitrou | 2011-01-12 22:19:59 +0100 (mer., 12 janv. 2011) | 3 lines Make test skipping message nicer, and remove the rather useless "overhead" parameter. ........ r87972 | antoine.pitrou | 2011-01-12 22:40:20 +0100 (mer., 12 janv. 2011) | 3 lines Fix @bigmemtest when no limit is given by the user (oops) ........ r87973 | antoine.pitrou | 2011-01-12 22:50:44 +0100 (mer., 12 janv. 2011) | 3 lines More informative skip message in @bigaddrspace ........ r87974 | antoine.pitrou | 2011-01-12 22:58:39 +0100 (mer., 12 janv. 2011) | 3 lines A better message again ........ r87975 | antoine.pitrou | 2011-01-12 23:02:45 +0100 (mer., 12 janv. 2011) | 3 lines Fix test_bigaddrspace (some tests didn't trigger the expected MemoryError) ........
Diffstat (limited to 'Lib/test/test_bigmem.py')
-rw-r--r--Lib/test/test_bigmem.py10
1 files changed, 7 insertions, 3 deletions
diff --git a/Lib/test/test_bigmem.py b/Lib/test/test_bigmem.py
index 7def22b..aec3778 100644
--- a/Lib/test/test_bigmem.py
+++ b/Lib/test/test_bigmem.py
@@ -564,8 +564,11 @@ class StrTest(unittest.TestCase, BaseStrTest):
if expectedsize is None:
expectedsize = size
- s = c * size
- self.assertEqual(len(s.encode(enc)), expectedsize)
+ try:
+ s = c * size
+ self.assertEqual(len(s.encode(enc)), expectedsize)
+ finally:
+ s = None
def setUp(self):
# HACK: adjust memory use of tests inherited from BaseStrTest
@@ -586,7 +589,8 @@ class StrTest(unittest.TestCase, BaseStrTest):
for name, memuse in self._adjusted.items():
getattr(type(self), name).memuse = memuse
- @bigmemtest(minsize=_2G + 2, memuse=character_size + 1)
+ # the utf8 encoder preallocates big time (4x the number of characters)
+ @bigmemtest(minsize=_2G + 2, memuse=character_size + 4)
def test_encode(self, size):
return self.basic_encode_test(size, 'utf-8')