Skip to content

Commit

Permalink
chore: Allow running before_add_examples hooks even if default exam…
Browse files Browse the repository at this point in the history
…ples generation failed
  • Loading branch information
Stranger6667 committed Dec 26, 2020
1 parent 71fb6ec commit 1c2c91f
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/schemathesis/_hypothesis.py
Expand Up @@ -74,7 +74,8 @@ def add_examples(test: Callable, endpoint: Endpoint, hook_dispatcher: Optional[H
# Unsatisfiable:
# The underlying schema is not satisfiable and test will raise an error for the same reason.
# Skipping this exception here allows us to continue the testing process for other operations.
return test
# Still, we allow to run user-defined hooks
examples = []
context = HookContext(endpoint) # context should be passed here instead
GLOBAL_HOOK_DISPATCHER.dispatch("before_add_examples", context, examples)
endpoint.schema.hooks.dispatch("before_add_examples", context, examples)
Expand Down

0 comments on commit 1c2c91f

Please sign in to comment.