[pypy-commit] pypy py3.5: Skip the tests for _collections.OrderedDict if we don't have it (and ATM we don't)

rlamy pypy.commits at gmail.com
Wed Nov 2 13:07:19 EDT 2016


Author: Ronan Lamy <ronan.lamy at gmail.com>
Branch: py3.5
Changeset: r88087:f655e46d5ffb
Date: 2016-11-02 17:06 +0000
http://bitbucket.org/pypy/pypy/changeset/f655e46d5ffb/

Log:	Skip the tests for _collections.OrderedDict if we don't have it (and
	ATM we don't)

diff --git a/lib-python/3/test/test_collections.py b/lib-python/3/test/test_collections.py
--- a/lib-python/3/test/test_collections.py
+++ b/lib-python/3/test/test_collections.py
@@ -1631,7 +1631,7 @@
 ################################################################################
 
 py_coll = import_fresh_module('collections', blocked=['_collections'])
-c_coll = import_fresh_module('collections', fresh=['_collections'])
+c_coll = import_fresh_module('_collections', fresh=['_collections'])
 
 
 @contextlib.contextmanager
@@ -2215,11 +2215,11 @@
     OrderedDict = py_coll.OrderedDict
 
 
- at unittest.skipUnless(c_coll, 'requires the C version of the collections module')
+ at unittest.skipUnless(hasattr(c_coll, 'OrderedDict'), 'requires the C version of the collections module')
 class CPythonOrderedDictTests(OrderedDictTests, unittest.TestCase):
 
     module = c_coll
-    OrderedDict = c_coll.OrderedDict
+    OrderedDict = getattr(c_coll, 'OrderedDict', None)
 
     def test_key_change_during_iteration(self):
         OrderedDict = self.OrderedDict
@@ -2249,8 +2249,10 @@
 class CPythonOrderedDictSubclassTests(CPythonOrderedDictTests):
 
     module = c_coll
-    class OrderedDict(c_coll.OrderedDict):
-        pass
+
+    if hasattr(c_coll, 'OrderedDict'):
+        class OrderedDict(c_coll.OrderedDict):
+            pass
 
 
 class PurePythonGeneralMappingTests(mapping_tests.BasicTestMappingProtocol):
@@ -2264,7 +2266,7 @@
         self.assertRaises(KeyError, d.popitem)
 
 
- at unittest.skipUnless(c_coll, 'requires the C version of the collections module')
+ at unittest.skipUnless(hasattr(c_coll, 'OrderedDict'), 'requires the C version of the collections module')
 class CPythonGeneralMappingTests(mapping_tests.BasicTestMappingProtocol):
 
     @classmethod
@@ -2289,7 +2291,7 @@
         self.assertRaises(KeyError, d.popitem)
 
 
- at unittest.skipUnless(c_coll, 'requires the C version of the collections module')
+ at unittest.skipUnless(hasattr(c_coll, 'OrderedDict'), 'requires the C version of the collections module')
 class CPythonSubclassMappingTests(mapping_tests.BasicTestMappingProtocol):
 
     @classmethod


More information about the pypy-commit mailing list