mirror of
https://github.com/python/cpython.git
synced 2025-07-29 22:24:49 +00:00
Disable a test that is unreliable.
This commit is contained in:
parent
b255069d43
commit
40f55b2f08
1 changed files with 16 additions and 11 deletions
|
@ -1,5 +1,6 @@
|
||||||
from ctypes import *
|
from ctypes import *
|
||||||
import unittest, sys
|
import unittest, sys
|
||||||
|
from ctypes.test import is_resource_enabled
|
||||||
|
|
||||||
################################################################
|
################################################################
|
||||||
# This section should be moved into ctypes\__init__.py, when it's ready.
|
# This section should be moved into ctypes\__init__.py, when it's ready.
|
||||||
|
@ -33,20 +34,24 @@ class PythonAPITestCase(unittest.TestCase):
|
||||||
del pyob
|
del pyob
|
||||||
self.failUnlessEqual(grc(s), refcnt)
|
self.failUnlessEqual(grc(s), refcnt)
|
||||||
|
|
||||||
def test_PyInt_Long(self):
|
if is_resource_enabled("refcount"):
|
||||||
ref42 = grc(42)
|
# This test is unreliable, because it is possible that code in
|
||||||
pythonapi.PyInt_FromLong.restype = py_object
|
# unittest changes the refcount of the '42' integer. So, it
|
||||||
self.failUnlessEqual(pythonapi.PyInt_FromLong(42), 42)
|
# is disabled by default.
|
||||||
|
def test_PyInt_Long(self):
|
||||||
|
ref42 = grc(42)
|
||||||
|
pythonapi.PyInt_FromLong.restype = py_object
|
||||||
|
self.failUnlessEqual(pythonapi.PyInt_FromLong(42), 42)
|
||||||
|
|
||||||
self.failUnlessEqual(grc(42), ref42)
|
self.failUnlessEqual(grc(42), ref42)
|
||||||
|
|
||||||
pythonapi.PyInt_AsLong.argtypes = (py_object,)
|
pythonapi.PyInt_AsLong.argtypes = (py_object,)
|
||||||
pythonapi.PyInt_AsLong.restype = c_long
|
pythonapi.PyInt_AsLong.restype = c_long
|
||||||
|
|
||||||
res = pythonapi.PyInt_AsLong(42)
|
res = pythonapi.PyInt_AsLong(42)
|
||||||
self.failUnlessEqual(grc(res), ref42 + 1)
|
self.failUnlessEqual(grc(res), ref42 + 1)
|
||||||
del res
|
del res
|
||||||
self.failUnlessEqual(grc(42), ref42)
|
self.failUnlessEqual(grc(42), ref42)
|
||||||
|
|
||||||
def test_PyObj_FromPtr(self):
|
def test_PyObj_FromPtr(self):
|
||||||
s = "abc def ghi jkl"
|
s = "abc def ghi jkl"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue