Level-up your Hypothesis tests with CrossHair.
Project description
hypothesis-crosshair
Add the power of solver-based symbolic execution to your Hypothesis tests with CrossHair.
Just
pip install hypothesis-crosshair
and then add a backend="crosshair" setting, like so:
from hypothesis import given, settings, strategies as st
@settings(backend="crosshair")
@given(st.integers())
def test_needs_solver(x):
assert x != 123456789
Docs hopefully coming soon. In the meantime, start a discussion or file an issue.
FAQ
Can I try using crosshair for ALL my hypothesis tests?
Yes! Create or edit your pytest conftest.py file to register a profile like the following:
from hypothesis import settings
settings.register_profile(
"crosshair",
backend="crosshair",
)
And then run pytest using the profile you've defined:
pytest . --hypothesis-profile=crosshair
Changelog
0.0.15
- Integrate hypothesis's new BackCannotProceed exception, which will reduce the likelihood of FlakeyReplay errors.
- Validate suspected counterexamples with concrete executions.
- Treat nondeterminism as an unexplored path rather than a user error. (though we might change this back later)
- Ensure realization logic called by hypothesis cannot grow the path tree.
- Allow for collapsing more SMT expressions when drawing strings and floats.
0.0.14
- Support the revised hypothesis provider draw interfaces as of hypothesis
v6.112.0
.
0.0.13
- Integrate with the hypothesis observability system.
0.0.12
- Error early when trying to nest hypothesis tests. (which will otherwise put CrossHair into a bad state)
0.0.11
- Address errors when the solver can't keep up (fixes #20)
0.0.10
- Reduce the numebr of iterations required to generate valid datetimes
0.0.9
- Quietly ignore iterations that appear to be failing due to symbolic intolerance.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Close
Hashes for hypothesis_crosshair-0.0.16.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9ae9a1e5941c725fbb0568e311ed44ba732184e5b72b3daed11a38746376a7ad |
|
MD5 | 6d4af64bf3a5dbac7f91c93230fb8706 |
|
BLAKE2b-256 | e1acf916c631dab8e405b8db4ee33390fcc0f30c308d4f6fed094415d396933f |
Close
Hashes for hypothesis_crosshair-0.0.16-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d20b6e7b62759ef82beca42aed0cdacd6252f8fce8b809634a887d9258d1a628 |
|
MD5 | 76b9ed6dbf8d9041b2d8675737d1764f |
|
BLAKE2b-256 | 16378a793d01273a1f449ab5cf2b98259532fd3be6c249829e213d044a31a07c |