[pypy-svn] pypy default: (lac, arigo)

arigo commits-noreply at bitbucket.org
Mon Jan 17 14:57:44 CET 2011


Author: Armin Rigo <arigo at tunes.org>
Branch: 
Changeset: r40764:cd3f0bff27bc
Date: 2011-01-17 11:30 +0100
http://bitbucket.org/pypy/pypy/changeset/cd3f0bff27bc/

Log:	(lac, arigo)

	Fix this test by allowing RuntimeErrors to get out of a dict
	comparison when the dicts are being mutated.

diff --git a/lib-python/2.7.0/test/test_mutants.py b/lib-python/modified-2.7.0/test/test_mutants.py
copy from lib-python/2.7.0/test/test_mutants.py
copy to lib-python/modified-2.7.0/test/test_mutants.py
--- a/lib-python/2.7.0/test/test_mutants.py
+++ b/lib-python/modified-2.7.0/test/test_mutants.py
@@ -1,4 +1,4 @@
-from test.test_support import verbose, TESTFN
+from test.test_support import verbose, TESTFN, check_impl_detail
 import random
 import os
 
@@ -137,10 +137,16 @@
     while dict1 and len(dict1) == len(dict2):
         if verbose:
             print ".",
-        if random.random() < 0.5:
-            c = cmp(dict1, dict2)
-        else:
-            c = dict1 == dict2
+        try:
+            if random.random() < 0.5:
+                c = cmp(dict1, dict2)
+            else:
+                c = dict1 == dict2
+        except RuntimeError:
+            # CPython never raises RuntimeError here, but other implementations
+            # might, and it's fine.
+            if check_impl_detail(cpython=True):
+                raise
     if verbose:
         print
 


More information about the Pypy-commit mailing list