summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFlorent Xicluna <florent.xicluna@gmail.com>2010-08-14 15:56:42 (GMT)
committerFlorent Xicluna <florent.xicluna@gmail.com>2010-08-14 15:56:42 (GMT)
commitaa17106e412b177931c3caa12a4dab2fb3bea152 (patch)
treeb5710e576daecd1675b304390d63d00cec9b8e41
parent54ebb78171a8c75cbdc46196990386da80e2419e (diff)
downloadcpython-aa17106e412b177931c3caa12a4dab2fb3bea152.zip
cpython-aa17106e412b177931c3caa12a4dab2fb3bea152.tar.gz
cpython-aa17106e412b177931c3caa12a4dab2fb3bea152.tar.bz2
Merged manually from 2.7 branch to 3.x trunk.
------------------------------------------------------------------------ r79925 | nick.coghlan | 2010-04-10 16:24:36 +0200 (sam. 10 avril 2010) Try to turn some buildbots green by allowing test_multiprocessing to pass even if it hits the sys.exc_clear code in the threading module, and improve the test coverage by making the ctypes dependencies a bit more granular (two of the cited ctypes objects don't exist on my system) ------------------------------------------------------------------------
-rw-r--r--Lib/test/test_multiprocessing.py24
1 files changed, 16 insertions, 8 deletions
diff --git a/Lib/test/test_multiprocessing.py b/Lib/test/test_multiprocessing.py
index 96df502..73d12dc 100644
--- a/Lib/test/test_multiprocessing.py
+++ b/Lib/test/test_multiprocessing.py
@@ -13,7 +13,6 @@ import os
import gc
import signal
import array
-import copy
import socket
import random
import logging
@@ -71,11 +70,21 @@ WIN32 = (sys.platform == "win32")
#
try:
- from ctypes import Structure, Value, copy, c_int, c_double
+ from ctypes import Structure, c_int, c_double
except ImportError:
Structure = object
c_int = c_double = None
+try:
+ from ctypes import Value
+except ImportError:
+ Value = None
+
+try:
+ from ctypes import copy as ctypes_copy
+except ImportError:
+ ctypes_copy = None
+
#
# Creates a wrapper for a function which records the time it takes to finish
#
@@ -1138,12 +1147,10 @@ def baz():
yield i*i
class IteratorProxy(BaseProxy):
- _exposed_ = ('next', '__next__')
+ _exposed_ = ('__next__',)
def __iter__(self):
return self
def __next__(self):
- return self._callmethod('next')
- def __next__(self):
return self._callmethod('__next__')
class MyManager(BaseManager):
@@ -1600,7 +1607,7 @@ class _TestSharedCTypes(BaseTestCase):
for i in range(len(arr)):
arr[i] *= 2
- @unittest.skipIf(c_int is None, "requires _ctypes")
+ @unittest.skipIf(Value is None, "requires ctypes.Value")
def test_sharedctypes(self, lock=False):
x = Value('i', 7, lock=lock)
y = Value(c_double, 1.0/3.0, lock=lock)
@@ -1621,13 +1628,14 @@ class _TestSharedCTypes(BaseTestCase):
self.assertAlmostEqual(arr[i], i*2)
self.assertEqual(string.value, latin('hellohello'))
+ @unittest.skipIf(Value is None, "requires ctypes.Value")
def test_synchronize(self):
self.test_sharedctypes(lock=True)
- @unittest.skipIf(c_int is None, "requires _ctypes")
+ @unittest.skipIf(ctypes_copy is None, "requires ctypes.copy")
def test_copy(self):
foo = _Foo(2, 5.0)
- bar = copy(foo)
+ bar = ctypes_copy(foo)
foo.x = 0
foo.y = 0
self.assertEqual(bar.x, 2)