Re: [Python-Dev] cpython (2.7): Fix memory error in test_ucn.
On Mon, 21 Jan 2013 12:06:25 +0100 (CET)
serhiy.storchaka
diff --git a/Lib/test/test_ucn.py b/Lib/test/test_ucn.py --- a/Lib/test/test_ucn.py +++ b/Lib/test/test_ucn.py @@ -144,13 +144,14 @@ # very very long bogus character name try: x = b'\\N{SPACE' + b'x' * int(_testcapi.UINT_MAX + 1) + b'}' + self.assertEqual(len(x), len(b'\\N{SPACE}') + + (_testcapi.UINT_MAX + 1)) + self.assertRaisesRegexp(UnicodeError, + 'unknown Unicode character name', + x.decode, 'unicode-escape' + ) except MemoryError: raise unittest.SkipTest("not enough memory") - self.assertEqual(len(x), len(b'\\N{SPACE}') + (_testcapi.UINT_MAX + 1)) - self.assertRaisesRegexp(UnicodeError, - 'unknown Unicode character name', - x.decode, 'unicode-escape' - )
You can't just do that. The test may end up swapping a lot and make the machine grind to a halt, rather than raise MemoryError. This threatens to make life miserable for anyone who hasn't enough RAM, but has enough swap to fit the test's working set. Really, you have to use a bigmem decorator. Regards Antoine.
participants (1)
-
Antoine Pitrou