Allow use of Hypothesis for property-based tests

Matt Haberland <[email protected]> Wed, 2 Aug 2023 14:58:03 -0700
Newsgroups gmane.comp.python.scientific.devel
Message-ID <CADuxUiwaRxuAUbt1G6kaZ1gnxFHQy+FJBf-52OT3kO8g6OonVA@mail.gmail.com>
Hi team,

I'd like to propose adding Hypothesis
<https://hypothesis.readthedocs.io/en/latest/> as a test-time dependency.
>From the documentation:

Hypothesis is a Python library for creating unit tests which are simpler to
> write and more powerful when run, finding edge cases in your code you
> wouldn’t have thought to look for.


We write property-based tests all the time, but I think Hypothesis can help
us write them faster and make them stronger. Apparently NumPy, pandas, and many
other projects <https://hypothesis.readthedocs.io/en/latest/usage.html> that
use Hypothesis think so, too.

I imagine one of the concerns will be test duration, but this is no
different from other parameterized tests, and we can use pytest markers
(`slow`, `xslow`) to limit that as always.

Another concern would be nondeterminism in the CI suite. To address this,
we've set up both a default deterministic profile and opt-in (via
environment variable) nondeterministic profile.

Please let us know your thoughts here and in the PR:
https://github.com/scipy/scipy/pull/18927

Matt

_______________________________________________
SciPy-Dev mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/scipy-dev.python.org/
Member address: [email protected]