From a0cbc108ba9dbdd4cc223486561f3e6a347e2d0a Mon Sep 17 00:00:00 2001 From: Paul Sokolovsky Date: Thu, 9 Mar 2017 00:11:05 +0100 Subject: [PATCH] tests/float: Make various tests skippable. --- tests/float/array_construct.py | 7 ++++++- tests/float/builtin_float_minmax.py | 7 +++++++ tests/float/float_array.py | 7 ++++++- tests/float/float_struct.py | 12 ++++++++---- 4 files changed, 27 insertions(+), 6 deletions(-) diff --git a/tests/float/array_construct.py b/tests/float/array_construct.py index a25cc72c80..7e01fd4768 100644 --- a/tests/float/array_construct.py +++ b/tests/float/array_construct.py @@ -1,6 +1,11 @@ # test construction of array from array with float type -from array import array +try: + from array import array +except ImportError: + import sys + print("SKIP") + sys.exit() print(array('f', array('h', [1, 2]))) print(array('d', array('f', [1, 2]))) diff --git a/tests/float/builtin_float_minmax.py b/tests/float/builtin_float_minmax.py index ce45a768a5..42cfa63822 100644 --- a/tests/float/builtin_float_minmax.py +++ b/tests/float/builtin_float_minmax.py @@ -1,4 +1,11 @@ # test builtin min and max functions with float args +try: + min + max +except: + import sys + print("SKIP") + sys.exit() print(min(0,1.0)) print(min(1.0,0)) diff --git a/tests/float/float_array.py b/tests/float/float_array.py index 033877db3c..8bc9634449 100644 --- a/tests/float/float_array.py +++ b/tests/float/float_array.py @@ -1,4 +1,9 @@ -from array import array +try: + from array import array +except ImportError: + import sys + print("SKIP") + sys.exit() def test(a): print(a) diff --git a/tests/float/float_struct.py b/tests/float/float_struct.py index e55890a2cd..a36ccce38b 100644 --- a/tests/float/float_struct.py +++ b/tests/float/float_struct.py @@ -1,9 +1,13 @@ # test struct package with floats - try: - import ustruct as struct -except: - import struct + try: + import ustruct as struct + except: + import struct +except ImportError: + import sys + print("SKIP") + sys.exit() i = 1. + 1/2 # TODO: it looks like '=' format modifier is not yet supported