Skip to content

Commit 5190159

Browse files
committed
skip tests on older versions
1 parent 95d4fda commit 5190159

1 file changed

Lines changed: 9 additions & 3 deletions

File tree

tests/test_security.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,20 +77,26 @@ def test_container_root_is_not_allowed_at_low_depth():
7777
pack(_nested_list(1), max_depth=1)
7878

7979

80+
@pytest.mark.skipif(
81+
sys.version_info < (3, 12), reason="Test limits accurate on Python 3.12 or higher"
82+
)
8083
def test_recursion_limit_pack():
8184
limit = sys.getrecursionlimit() - get_stack_depth()
8285
obj = _nested_list(limit)
8386

84-
# assert obj
85-
# pack(obj[0])
87+
assert obj
88+
pack(obj[0])
8689

8790
with pytest.raises(RecursionError, match="maximum recursion depth exceeded"):
8891
pack(obj)
8992

9093

94+
@pytest.mark.skipif(
95+
sys.version_info < (3, 12), reason="Test limits accurate on Python 3.12 or higher"
96+
)
9197
def test_recursion_limit_unpack():
9298
previous_limit = sys.getrecursionlimit()
93-
with recursion_limit(previous_limit + get_stack_depth() + 5):
99+
with recursion_limit(previous_limit + get_stack_depth() + 1):
94100
data = pack(_nested_list(previous_limit))
95101
with pytest.raises(RecursionError, match="maximum recursion depth exceeded"):
96102
unpack(data)

0 commit comments

Comments
 (0)