[pypy-commit] pypy default: Fix the test (failed on OS/X 64 because x==y==sys.maxint typically)

arigo pypy.commits at gmail.com
Wed Aug 24 05:52:03 EDT 2016


Author: Armin Rigo <arigo at tunes.org>
Branch: 
Changeset: r86470:6bfe423a36a4
Date: 2016-08-24 11:51 +0200
http://bitbucket.org/pypy/pypy/changeset/6bfe423a36a4/

Log:	Fix the test (failed on OS/X 64 because x==y==sys.maxint typically)

diff --git a/pypy/module/test_lib_pypy/test_resource.py b/pypy/module/test_lib_pypy/test_resource.py
--- a/pypy/module/test_lib_pypy/test_resource.py
+++ b/pypy/module/test_lib_pypy/test_resource.py
@@ -1,4 +1,5 @@
 from __future__ import absolute_import
+import sys
 
 import os
 if os.name != 'posix':
@@ -47,6 +48,9 @@
     # minimal "does not crash" test
     x, y = resource.getrlimit(resource.RLIMIT_CPU)
     resource.setrlimit(resource.RLIMIT_CPU, (x, y))
-    x += 0.2
-    y += 0.3
-    resource.setrlimit(resource.RLIMIT_CPU, (x, y))    # truncated to ints
+    # sometimes, x and y are very large (more than 53 bits).
+    # for these huge values, int(float(x)) > x...
+    xf = x + 0.2
+    yf = y + 0.3
+    if int(xf) == x and int(yf) == y:
+        resource.setrlimit(resource.RLIMIT_CPU, (x, y))  # truncated to ints


More information about the pypy-commit mailing list