diff --git a/tests/test_circular.py b/tests/test_circular.py index 07c66a3..d76d921 100644 --- a/tests/test_circular.py +++ b/tests/test_circular.py @@ -54,7 +54,15 @@ def test_max_recursion_depth(dumps): dumps(root) rl = sys.getrecursionlimit() - sys.setrecursionlimit(500) + + if hasattr(sys, "pyston_version_info"): + # In Pyston setrecursionlimit() sets a lower bound on the number of frames, + # not an exact count. So set the limit lower: + sys.setrecursionlimit(100) + else: + # Otherwise set it to the exact value: + sys.setrecursionlimit(500) + try: with pytest.raises(expected_exception): dumps(root) diff --git a/tests/test_memory_leaks.py b/tests/test_memory_leaks.py index 8d2116d..015ba73 100644 --- a/tests/test_memory_leaks.py +++ b/tests/test_memory_leaks.py @@ -9,11 +9,12 @@ import io import datetime import gc -import tracemalloc import pytest import rapidjson as rj +tracemalloc = pytest.importorskip("tracemalloc") + def object_hook(td): if '__td__' in td: