Make this test more 32 bit friendly: allocate the most memory that fits into a native integer.
This will avoid triggering an OverflowError on 32 bit platforms but still be more memory than can ever actually be allocated.
Also fix the implementation to accept Python longs as well as Python ints.
diff --git a/OpenSSL/test/test_rand.py b/OpenSSL/test/test_rand.py
index b5a992d..7d2559e 100644
--- a/OpenSSL/test/test_rand.py
+++ b/OpenSSL/test/test_rand.py
@@ -8,6 +8,7 @@
from unittest import main
import os
import stat
+import sys
from OpenSSL.test.util import TestCase, b
from OpenSSL import rand
@@ -29,7 +30,7 @@
:py:obj:`OpenSSL.rand.bytes` raises :py:obj:`MemoryError` if more bytes
are requested than will fit in memory.
"""
- self.assertRaises(MemoryError, rand.bytes, 1024 * 1024 * 1024 * 1024)
+ self.assertRaises(MemoryError, rand.bytes, sys.maxint)
def test_bytes(self):