Skip to content

Commit

Permalink
Suppress errors for proxy-intolerant C functions
Browse files Browse the repository at this point in the history
  • Loading branch information
pschanely committed Jul 22, 2024
1 parent cbb5dfb commit 7fc42e8
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 6 deletions.
6 changes: 3 additions & 3 deletions hypothesis_crosshair_provider/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ def _hypothesis_setup_hook(*a, **kw):
"This version of hypothesis doesn't support the CrossHair backend"
)
return
AVAILABLE_PROVIDERS[
"crosshair"
] = "hypothesis_crosshair_provider.crosshair_provider.CrossHairPrimitiveProvider"
AVAILABLE_PROVIDERS["crosshair"] = (
"hypothesis_crosshair_provider.crosshair_provider.CrossHairPrimitiveProvider"
)
8 changes: 7 additions & 1 deletion hypothesis_crosshair_provider/crosshair_provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
StateSpaceContext, UnexploredPath,
VerificationStatus, condition_parser,
context_statespace, get_current_parser, is_tracing,
proxy_for_type)
proxy_for_type,
suspected_proxy_intolerance_exception)
from crosshair.libimpl.builtinslib import (LazyIntSymbolicStr,
SymbolicBoundedIntTuple)
from crosshair.statespace import DeatchedPathNode
Expand Down Expand Up @@ -129,6 +130,11 @@ def per_test_case_context_manager(self):
raise exc
except (IgnoreAttempt, UnexploredPath):
pass
except TypeError as exc:
if suspected_proxy_intolerance_exception(exc):
pass
else:
raise
finally:
self._previous_space = space
if any_choices_made:
Expand Down
11 changes: 11 additions & 0 deletions hypothesis_crosshair_provider/end_to_end_test.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import math
import os
import re

import pytest
Expand Down Expand Up @@ -124,3 +125,13 @@ def a(self):
@rule()
def b(self):
pass


def test_proxy_intolerance():
@settings(backend="crosshair")
@given(st.text())
def f(t):
# ideally we keep this up-to-date with some C function that will not accept symbolics:
os.fspath(t)

f()
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

setuptools.setup(
name="hypothesis-crosshair",
version="0.0.8",
version="0.0.9",
author="Phillip Schanely",
author_email="[email protected]",
packages=setuptools.find_packages(),
Expand All @@ -11,7 +11,7 @@
description="Level-up your Hypothesis tests with CrossHair.",
long_description=open("README.md", encoding="utf-8").read(),
long_description_content_type="text/markdown",
install_requires=["hypothesis>=6.104.2", "crosshair-tool>=0.0.58"],
install_requires=["hypothesis>=6.104.2", "crosshair-tool>=0.0.63"],
python_requires=">=3.8",
entry_points={
"hypothesis": ["_ = hypothesis_crosshair_provider:_hypothesis_setup_hook"]
Expand Down

0 comments on commit 7fc42e8

Please sign in to comment.