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.18
- Ensure drawn floats respect hypothesis signed-zero semantics for min_value/max_value.
0.0.17
- Do not interpret Unsatisfiable errors as user exceptions; just re-throw, so that hypothesis can act appropriately.
- Report CrossHair path abortions to hypothesis as
discard_test_case
instead ofverified
. This lets Hypothesis report unsatisfiable strategies correctly when run under crosshair.
0.0.16
- 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.15
- (was never released)
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
File details
Details for the file hypothesis_crosshair-0.0.18.tar.gz
.
File metadata
- Download URL: hypothesis_crosshair-0.0.18.tar.gz
- Upload date:
- Size: 9.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.9.20
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d791b31b79064fb2f3e0aeb3c86e6a7619677b5791e667b385249d8a2a8df0c8 |
|
MD5 | 68692c8fe607510c197cc032524708ba |
|
BLAKE2b-256 | 025729a60c521ec9cdaf03abe9f17e34cd134a16de1c99b3ad424232b8878626 |
File details
Details for the file hypothesis_crosshair-0.0.18-py3-none-any.whl
.
File metadata
- Download URL: hypothesis_crosshair-0.0.18-py3-none-any.whl
- Upload date:
- Size: 10.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.9.20
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 51e96fafd9dcd608d373293be83c537dbac996b1574cb36bd9a1fb0442c1133f |
|
MD5 | 266a2ee31839bc1e6b42597860d16bff |
|
BLAKE2b-256 | 59735c7fde767e196acf1c408a3ca59c3e0018289993186da48517ff0eebe209 |