Skip to main content

Level-up your Hypothesis tests with CrossHair.

Project description

hypothesis-crosshair

Downloads

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.13

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

hypothesis_crosshair-0.0.13.tar.gz (8.5 kB view details)

Uploaded Source

Built Distribution

hypothesis_crosshair-0.0.13-py3-none-any.whl (9.9 kB view details)

Uploaded Python 3

File details

Details for the file hypothesis_crosshair-0.0.13.tar.gz.

File metadata

  • Download URL: hypothesis_crosshair-0.0.13.tar.gz
  • Upload date:
  • Size: 8.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.9.19

File hashes

Hashes for hypothesis_crosshair-0.0.13.tar.gz
Algorithm Hash digest
SHA256 cddfd7ca0fc822f93db2a792ca7b725bac1c9a1f6fd947f5208bbe8da294fe0d
MD5 5e45f048cd0e8c73fa961000c6568544
BLAKE2b-256 c196e53fd6308bdd0dc6594cd166c3ebf16d07aa834190699857e8094afb2a5b

See more details on using hashes here.

File details

Details for the file hypothesis_crosshair-0.0.13-py3-none-any.whl.

File metadata

File hashes

Hashes for hypothesis_crosshair-0.0.13-py3-none-any.whl
Algorithm Hash digest
SHA256 3e4cf895d74456105a4d380f372e81238b368ee6348b8a574c563df3768f0195
MD5 ce6795704db01e03f4650d92200cc628
BLAKE2b-256 dcfb8c52cc779df92470ac3d9f71e0ba6e3312d2221d3f6cdce308c333af0228

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page