summaryrefslogtreecommitdiffstats
path: root/Lib/ctypes/test
diff options
context:
space:
mode:
authorThomas Heller <theller@ctypes.org>2006-05-09 20:20:15 (GMT)
committerThomas Heller <theller@ctypes.org>2006-05-09 20:20:15 (GMT)
commit40f55b2f08c89cedb03b9af7fc3e5e2ffe68e219 (patch)
treeb8e26643593f4360276632e6719938e075713aa1 /Lib/ctypes/test
parentb255069d43f44cb5fee978edf580923979f38826 (diff)
downloadcpython-40f55b2f08c89cedb03b9af7fc3e5e2ffe68e219.zip
cpython-40f55b2f08c89cedb03b9af7fc3e5e2ffe68e219.tar.gz
cpython-40f55b2f08c89cedb03b9af7fc3e5e2ffe68e219.tar.bz2
Disable a test that is unreliable.
Diffstat (limited to 'Lib/ctypes/test')
-rw-r--r--Lib/ctypes/test/test_python_api.py27
1 files changed, 16 insertions, 11 deletions
diff --git a/Lib/ctypes/test/test_python_api.py b/Lib/ctypes/test/test_python_api.py
index c29b721..78e0231 100644
--- a/Lib/ctypes/test/test_python_api.py
+++ b/Lib/ctypes/test/test_python_api.py
@@ -1,5 +1,6 @@
from ctypes import *
import unittest, sys
+from ctypes.test import is_resource_enabled
################################################################
# This section should be moved into ctypes\__init__.py, when it's ready.
@@ -33,20 +34,24 @@ class PythonAPITestCase(unittest.TestCase):
del pyob
self.failUnlessEqual(grc(s), refcnt)
- def test_PyInt_Long(self):
- ref42 = grc(42)
- pythonapi.PyInt_FromLong.restype = py_object
- self.failUnlessEqual(pythonapi.PyInt_FromLong(42), 42)
+ if is_resource_enabled("refcount"):
+ # This test is unreliable, because it is possible that code in
+ # unittest changes the refcount of the '42' integer. So, it
+ # 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.restype = c_long
+ pythonapi.PyInt_AsLong.argtypes = (py_object,)
+ pythonapi.PyInt_AsLong.restype = c_long
- res = pythonapi.PyInt_AsLong(42)
- self.failUnlessEqual(grc(res), ref42 + 1)
- del res
- self.failUnlessEqual(grc(42), ref42)
+ res = pythonapi.PyInt_AsLong(42)
+ self.failUnlessEqual(grc(res), ref42 + 1)
+ del res
+ self.failUnlessEqual(grc(42), ref42)
def test_PyObj_FromPtr(self):
s = "abc def ghi jkl"