mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
Merged revisions 83212,83829,83833,83838-83839,83878,84019,84025,84028,84032,84036 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k ........ r83212 | florent.xicluna | 2010-07-28 18:39:41 +0200 (mer., 28 juil. 2010) | 2 lines Syntax cleanup. ........ r83829 | florent.xicluna | 2010-08-08 18:16:07 +0200 (dim., 08 août 2010) | 2 lines Use unittest specific methods for some urllib test cases. And replace urllib2 with urllib.request in comments. ........ r83833 | florent.xicluna | 2010-08-08 18:25:27 +0200 (dim., 08 août 2010) | 2 lines Add test case for the HTTPResponse being an iterable. Follow-up of issue #4608. ........ r83838 | florent.xicluna | 2010-08-08 20:03:44 +0200 (dim., 08 août 2010) | 2 lines Typo. ........ r83839 | florent.xicluna | 2010-08-08 20:06:13 +0200 (dim., 08 août 2010) | 2 lines Issue #7564: Skip test_ioctl if another process is attached to /dev/tty. ........ r83878 | florent.xicluna | 2010-08-09 10:29:08 +0200 (lun., 09 août 2010) | 1 line Merge the 2to3 script from /sandbox/trunk/2to3/2to3, revision 72867 (latest). ........ r84019 | florent.xicluna | 2010-08-14 17:56:42 +0200 (sam., 14 août 2010) | 11 lines 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) ------------------------------------------------------------------------ ........ r84025 | florent.xicluna | 2010-08-14 18:56:27 +0200 (sam., 14 août 2010) | 1 line List Misc/python-config.in in Misc/README. Fix few typos. ........ r84028 | florent.xicluna | 2010-08-14 19:02:49 +0200 (sam., 14 août 2010) | 1 line Fix order. ........ r84032 | florent.xicluna | 2010-08-14 19:15:31 +0200 (sam., 14 août 2010) | 1 line Convert to spaces. ........ r84036 | florent.xicluna | 2010-08-14 20:03:19 +0200 (sam., 14 août 2010) | 1 line Remove bad merge (from svnmerge r82301) ........
This commit is contained in:
parent
3554473309
commit
b4efb3d81e
16 changed files with 156 additions and 112 deletions
|
@ -14,7 +14,6 @@ import os
|
|||
import gc
|
||||
import signal
|
||||
import array
|
||||
import copy
|
||||
import socket
|
||||
import random
|
||||
import logging
|
||||
|
@ -68,11 +67,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
|
||||
#
|
||||
|
@ -1103,11 +1112,9 @@ 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__')
|
||||
|
||||
|
@ -1565,7 +1572,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(ctypes.c_double, 1.0/3.0, lock=lock)
|
||||
|
@ -1586,13 +1593,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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue