|
9 | 9 | # obtain one at https://mozilla.org/MPL/2.0/.
|
10 | 10 |
|
11 | 11 | import gc
|
12 |
| -import math |
13 |
| -import sys |
14 | 12 | import time
|
15 | 13 |
|
16 | 14 | import pytest
|
17 | 15 |
|
18 | 16 | from hypothesis import given, settings, strategies as st
|
19 | 17 | from hypothesis.errors import DeadlineExceeded, Flaky, InvalidArgument
|
20 |
| -from hypothesis.internal.conjecture import junkdrawer |
21 |
| -from hypothesis.internal.observability import TESTCASE_CALLBACKS |
22 | 18 |
|
23 | 19 | from tests.common.utils import assert_falsifying_output, fails_with
|
24 | 20 |
|
@@ -161,7 +157,9 @@ def delay(phase, _info):
|
161 | 157 | gc.callbacks.remove(delay)
|
162 | 158 |
|
163 | 159 |
|
164 |
| -@pytest.mark.skipif(not hasattr(gc, "callbacks"), reason="PyPy has weird stack-limit behaviour") |
| 160 | +@pytest.mark.skipif( |
| 161 | + not hasattr(gc, "callbacks"), reason="PyPy has weird stack-limit behaviour" |
| 162 | +) |
165 | 163 | def test_gc_hooks_do_not_cause_unraisable_recursionerror():
|
166 | 164 | # We were concerned in #3979 that we might see bad results from a RecursionError
|
167 | 165 | # inside the GC hook, if the stack was already deep and someone (e.g. Pytest)
|
@@ -217,8 +215,9 @@ def inner_test(_):
|
217 | 215 | break
|
218 | 216 |
|
219 | 217 | # Verify limits w/o any gc interfering
|
220 |
| - gen_cycles_at_depth(max_depth - 1, gc_disable=True) # this line raises RecursionError on Pypy |
221 |
| - gen_cycles_at_depth(max_depth, gc_disable=True) # while this line doesn't |
| 218 | + gen_cycles_at_depth(max_depth - 1, gc_disable=True) |
| 219 | + # the previous line raises RecursionError on Pypy, while the next doesn't (!) |
| 220 | + gen_cycles_at_depth(max_depth, gc_disable=True) |
222 | 221 | with pytest.raises(RecursionError):
|
223 | 222 | gen_cycles_at_depth(max_depth + 1, gc_disable=True)
|
224 | 223 |
|
|
0 commit comments