diff --git a/hypothesis-python/RELEASE-sample.rst b/hypothesis-python/RELEASE-sample.rst index 373c6b801f..8e2d6d1c47 100644 --- a/hypothesis-python/RELEASE-sample.rst +++ b/hypothesis-python/RELEASE-sample.rst @@ -25,7 +25,10 @@ which should: - :func:`package.function` for link to functions, where the link text will be ``package.function``, or :func:`~package.function` to show ``function``. - :class:`package.class` for link to classes (abbreviated as above). - - :issue:`issue-number` for referencing issues or :pull:`pr-number` for PRs. + - :issue:`issue-number` for referencing issues. + - Similarly, :pull:`pr-number` can be used for PRs, but it's usually + preferred to refer to version numbers such as :ref:`version 6.98.9 , + as they are meaningful to end users. - :doc:`link text ` for documentation references. - `link text `__ is the same link, for general web addresses. diff --git a/hypothesis-python/RELEASE.rst b/hypothesis-python/RELEASE.rst index ee6c398c14..b21de76dda 100644 --- a/hypothesis-python/RELEASE.rst +++ b/hypothesis-python/RELEASE.rst @@ -1,5 +1,8 @@ RELEASE_TYPE: patch Account for time spent in garbage collection during tests, to avoid -flaky ``DeadlineExceeded`` errors as seen in :issue:`3975`. Also fixes -overcounting of stateful run times resulting from :issue:`3890`. +flaky ``DeadlineExceeded`` errors as seen in :issue:`3975`. + +Also fixes overcounting of stateful run times, +a minor observability bug dating to :ref:`version 6.98.9 ` +(:issue:`3890`). diff --git a/hypothesis-python/tests/nocover/test_recursive.py b/hypothesis-python/tests/nocover/test_recursive.py index 077da8fbb3..ab01f07d24 100644 --- a/hypothesis-python/tests/nocover/test_recursive.py +++ b/hypothesis-python/tests/nocover/test_recursive.py @@ -195,10 +195,11 @@ def test_gc_hooks_do_not_cause_unraisable_recursionerror(): # This test is potentially flaky, because the stack usage of a function is not # constant. Regardless, if the test passes just once that's sufficient proof that - # it's not the GC (or accounting of it) that is at fault. + # it's not the GC (or accounting of it) that is at fault. Note, I haven't actually + # seen it fail/flake, but I believe it could happen in principle. - # The number of cycles sufficient to reliably trigger a GC cycle, experimentally - # found to be a few hundred on CPython. Multiply by 10 for safety margin. + # The number of cycles sufficient to reliably trigger GC, experimentally found + # to be a few hundred on CPython. Multiply by 10 for safety margin. NUM_CYCLES = 5_000 def probe_depth(): @@ -251,12 +252,16 @@ def inner_test(_): max_depth -= 1 else: break - # Note that PyPy is a bit weird, in that it raises RecursionError at - # (maxdepth - n) for small positive n, but not at exactly (maxdepth). - # In general, it is really finicky to get the details right in this - # test, so be careful. - - # Now check that the limit is unchanged with gc enabled + # Note that PyPy is a bit weird, in that it raises RecursionError at + # (maxdepth - n) for small positive n, but not at exactly (maxdepth). + # In general, it is really finicky to get the details right in this + # test, so be careful. + + # Now check that the limit is unchanged with gc enabled, and also that + # leaving a few frames for the callbacks does not fail. + if hasattr(gc, "callbacks"): # see comment above + for n in range(1, 4): + gen_cycles_at_depth(max_depth - n, gc_disable=False) gen_cycles_at_depth(max_depth, gc_disable=False) with pytest.raises(RecursionError): gen_cycles_at_depth(max_depth + 1, gc_disable=False)