GithubHelp home page GithubHelp logo

Comments (5)

jobh avatar jobh commented on July 1, 2024 2

And thanks for the detailed investigation! It supplied all the clues 😁

from hypothesis.

jobh avatar jobh commented on July 1, 2024 1

After the first failure, the test is re-run under tracing to try to give more information about the failure. The busy loop is probably close to worst case for tracing performance impact.

To verify, you can add

import sys
sys.settrace(lambda *args: None)

at the top of the test. This will effectively disable hypothesis' tracing, since only one tracer can be attached.

Note that tracing is much faster in python >= 3.12.

from hypothesis.

mscheifer avatar mscheifer commented on July 1, 2024

After the first failure, the test is re-run under tracing to try to give more information about the failure. The busy loop is probably close to worst case for tracing performance impact.

To verify, you can add

import sys
sys.settrace(lambda *args: None)

at the top of the test. This will effectively disable hypothesis' tracing, since only one tracer can be attached.

Note that tracing is much faster in python >= 3.12.

Ahh yeah this is it. That does indeed make the issue go away. As does doing:

@settings(phases=[p for p in Phase if p != Phase.explain])

from hypothesis.

Zac-HD avatar Zac-HD commented on July 1, 2024

This is an unfortunate experience, but I don't think we can really improve on it - any solution would also make the logic more complicated, and therefore make Hypothesis harder to understand. Only a few years until all supported Python versions are fast, though...

from hypothesis.

mscheifer avatar mscheifer commented on July 1, 2024

Is it worth adding something to the error message? Like this message
Unreliable test timings! On an initial run, this test took 239.58ms, which exceeded the deadline of 100.00ms, but on a subsequent run it took 32.53 ms, which did not. If you expect this sort of variability in your test timings, consider turning deadlines off for this test by setting deadline=None.
could be extended to add
If you're testing CPU-bound pure-Python code, consider disabling the explain phase as it can slow down runs (or upgrade to Python 3.12).
for Python < 3.12

Or add a note in the docs? Maybe here https://hypothesis.readthedocs.io/en/latest/settings.html#controlling-what-runs

from hypothesis.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.