From 26d0b7f5b93bd26c0768d350061f25ee914b4fa9 Mon Sep 17 00:00:00 2001 From: William S Fulton Date: Thu, 4 Feb 2016 07:37:22 +0000 Subject: [PATCH] Disable tests broken in python 2.4 and 2.5 These tests were added in 2f8a7b82 and fc8e7654 in #572 and #573 but a change from a few months ago meant that the requested version of Python was not actually being used during testing when these were added. --- Examples/test-suite/python/primitive_types_runme.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/Examples/test-suite/python/primitive_types_runme.py b/Examples/test-suite/python/primitive_types_runme.py index c04dc9552..b2060a028 100644 --- a/Examples/test-suite/python/primitive_types_runme.py +++ b/Examples/test-suite/python/primitive_types_runme.py @@ -1,4 +1,3 @@ -import ctypes import sys from primitive_types import * @@ -443,6 +442,11 @@ if v != 4: # Check the bounds for converting various types # +# ctypes not available until 2.5 +if sys.version_info[0:2] <= (2, 4): + sys.exit(0) +import ctypes + # Get the minimum and maximum values that fit in signed char, short, int, long, and long long overchar = 2 ** 7 while ctypes.c_byte(overchar).value > 0: @@ -602,5 +606,6 @@ def checkType(name, maxfunc, maxval, minfunc, minval, echofunc): raise RuntimeError, "bad " + name + " typemap" # sys.maxsize is the largest value supported by Py_ssize_t, which should be the same as ptrdiff_t -checkType("ptrdiff_t", get_ptrdiff_max, sys.maxsize, get_ptrdiff_min, -(sys.maxsize + 1), ptrdiff_echo) -checkType("size_t", get_size_max, (2 * sys.maxsize) + 1, get_size_min, 0, size_echo) +if sys.version_info[0:2] >= (2, 6): + checkType("ptrdiff_t", get_ptrdiff_max, sys.maxsize, get_ptrdiff_min, -(sys.maxsize + 1), ptrdiff_echo) + checkType("size_t", get_size_max, (2 * sys.maxsize) + 1, get_size_min, 0, size_echo)