Allow use of Hypothesis for property-based tests
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
+1 from me, I’ma big fan of hypothesis On Thu, 3 Aug 2023 at 06:00, Matt Haberland <matt.haberland@gmail.com> wrote:
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 -- scipy-dev@python.org To unsubscribe send an email to scipy-dev-leave@python.org https://mail.python.org/mailman3/lists/scipy-dev.python.org/ Member address: kaistriega+python@gmail.com
participants (2)
-
Kai Striega -
Matt Haberland