Facundo Batista <facundobatista <at> gmail.com> writes:
> 
> The test_raiseMemError() in test_unicode.py is complicating me the
> regression tests: tries to use all the memory in my system, which
> starts to swap as crazy, and almost freezes everything. When the test
> finishes (always pass ok), I have all the memory flushed so it take a
> few seconds to go back to the normal system.

If the test does allocate the very large string, it means MemoryError isn't
raised, which defeats the purpose of the test.
I think that:
    u"a" * (sys.maxint // 2 - 100)
should be replaced with:
    u"a" * (sys.maxsize - 100)
The latter raises MemoryError reliably here, while the former doesn't.

An assertRaises could also be used in place of the try/except, it would ensure
the test does exercise what it is meant to exercise.

Regards

Antoine.


_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to