Skip to content

Commit 8183f1b

Browse files
committed
Complain if the test suite hits the network while running.
This is obviously non-ideal, and hits the same issue #693 asks to fix.
1 parent fcf88ae commit 8183f1b

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

jsonschema/tests/_suite.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,14 @@ def validate(self, Validator, **kwargs):
208208
store=self._remotes,
209209
id_of=Validator.ID_OF,
210210
)
211+
212+
# XXX: #693 asks to improve the public API for this, since yeah, it's
213+
# bad. Figures that since it's hard for end-users, we experience
214+
# the pain internally here too.
215+
def prevent_network_access(*args, **kwargs):
216+
raise RuntimeError("Tried to access the network!")
217+
resolver.resolve_remote = prevent_network_access
218+
211219
validator = Validator(schema=self.schema, resolver=resolver, **kwargs)
212220
if os.environ.get("JSON_SCHEMA_DEBUG", "0") != "0":
213221
breakpoint()

0 commit comments

Comments
 (0)