Skip to content

Commit e9e6d51

Browse files
committed
Do not expect failures from tests for schemas with recursive references
1 parent 4dc6e4c commit e9e6d51

File tree

2 files changed

+2
-17
lines changed

2 files changed

+2
-17
lines changed

src/hypothesis_jsonschema/_from_schema.py

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
FALSEY,
1818
TRUTHY,
1919
TYPE_STRINGS,
20-
HypothesisRefResolutionError,
2120
Schema,
2221
canonicalish,
2322
get_integer_bounds,
@@ -113,12 +112,7 @@ def __from_schema(
113112
*,
114113
custom_formats: Dict[str, st.SearchStrategy[str]] = None,
115114
) -> st.SearchStrategy[JSONType]:
116-
try:
117-
schema, _ = resolve_all_refs(schema)
118-
except RecursionError:
119-
raise HypothesisRefResolutionError(
120-
f"Could not resolve recursive references in schema={schema!r}"
121-
) from None
115+
schema, _ = resolve_all_refs(schema)
122116
# We check for _FORMATS_TOKEN to avoid re-validating known good data.
123117
if custom_formats is not None and _FORMATS_TOKEN not in custom_formats:
124118
assert isinstance(custom_formats, dict)

tests/test_from_schema.py

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
from hypothesis.internal.reflection import proxies
2222

2323
from hypothesis_jsonschema._canonicalise import (
24-
HypothesisRefResolutionError,
2524
canonicalish,
2625
resolve_all_refs,
2726
)
@@ -242,16 +241,8 @@ def inner(*args, **kwargs):
242241
assert isinstance(name, str)
243242
try:
244243
f(*args, **kwargs)
245-
assert name not in RECURSIVE_REFS
246244
except jsonschema.exceptions.RefResolutionError as err:
247-
if (
248-
isinstance(err, HypothesisRefResolutionError)
249-
or isinstance(err._cause, HypothesisRefResolutionError)
250-
) and (
251-
"does not fetch remote references" in str(err)
252-
or name in RECURSIVE_REFS
253-
and "Could not resolve recursive references" in str(err)
254-
):
245+
if "does not fetch remote references" in str(err):
255246
pytest.xfail()
256247
raise
257248

0 commit comments

Comments
 (0)