More informative skip message in @bigaddrspace

This commit is contained in:
Antoine Pitrou 2011-01-12 21:50:44 +00:00
parent 9dd1171305
commit e0d3f8a654
1 changed files with 7 additions and 3 deletions

View File

@ -1039,9 +1039,13 @@ def bigaddrspacetest(f):
"""Decorator for tests that fill the address space.""" """Decorator for tests that fill the address space."""
def wrapper(self): def wrapper(self):
if max_memuse < MAX_Py_ssize_t: if max_memuse < MAX_Py_ssize_t:
if verbose: if MAX_Py_ssize_t > 2**32:
sys.stderr.write("Skipping %s because of memory " raise unittest.SkipTest(
"constraint\n" % (f.__name__,)) "not enough memory: try a 32-bit build instead")
else:
raise unittest.SkipTest(
"not enough memory: %.1fG minimum needed"
% (MAX_Py_ssize_t / (1024 ** 3)))
else: else:
return f(self) return f(self)
return wrapper return wrapper