From 3e321f1724b4e2deae2a7750c789c6423f5201c2 Mon Sep 17 00:00:00 2001 From: Paul Sokolovsky Date: Sat, 11 Mar 2017 01:16:26 +0100 Subject: [PATCH] tests/misc/: Make few tests skippable. --- tests/misc/non_compliant.py | 9 +++++++-- tests/misc/print_exception.py | 13 +++++++++---- tests/misc/recursive_data.py | 7 ++++++- tests/misc/recursive_iternext.py | 10 ++++++++++ 4 files changed, 32 insertions(+), 7 deletions(-) diff --git a/tests/misc/non_compliant.py b/tests/misc/non_compliant.py index 8e5d586a9e..31074ab016 100644 --- a/tests/misc/non_compliant.py +++ b/tests/misc/non_compliant.py @@ -1,7 +1,12 @@ # tests for things that are not implemented, or have non-compliant behaviour -import array -import ustruct +try: + import array + import ustruct +except ImportError: + import sys + print("SKIP") + sys.exit() # when super can't find self try: diff --git a/tests/misc/print_exception.py b/tests/misc/print_exception.py index 30a732106c..b833a79816 100644 --- a/tests/misc/print_exception.py +++ b/tests/misc/print_exception.py @@ -1,8 +1,13 @@ -try: - import uio as io -except ImportError: - import io import sys +try: + try: + import uio as io + except ImportError: + import io +except ImportError: + print("SKIP") + sys.exit() + if hasattr(sys, 'print_exception'): print_exception = sys.print_exception else: diff --git a/tests/misc/recursive_data.py b/tests/misc/recursive_data.py index 0de93acb89..3830189453 100644 --- a/tests/misc/recursive_data.py +++ b/tests/misc/recursive_data.py @@ -1,5 +1,10 @@ # This tests that printing recursive data structure doesn't lead to segfault. -import uio as io +try: + import uio as io +except ImportError: + import sys + print("SKIP") + sys.exit() l = [1, 2, 3, None] l[-1] = l diff --git a/tests/misc/recursive_iternext.py b/tests/misc/recursive_iternext.py index 025fa425b5..d90f177168 100644 --- a/tests/misc/recursive_iternext.py +++ b/tests/misc/recursive_iternext.py @@ -1,4 +1,14 @@ # This tests that recursion with iternext doesn't lead to segfault. +try: + enumerate + filter + map + max + zip +except: + import sys + print("SKIP") + sys.exit() # We need to pick an N that is large enough to hit the recursion # limit, but not too large that we run out of heap memory.