diff --git a/pytest_steps/steps_generator.py b/pytest_steps/steps_generator.py index 4382142..6777f3b 100644 --- a/pytest_steps/steps_generator.py +++ b/pytest_steps/steps_generator.py @@ -310,7 +310,8 @@ def execute(self, step_name, *args, **kwargs): elif isinstance(res, optional_step): # optional step: check if the execution went well if res.exec_result is None: - raise ValueError("Internal error: this should not happen") + raise ValueError("Internal error: this should not happen." + "Did you ``yield step_b`` inside the context manager instead of after it?") elif isinstance(res.exec_result, OptionalStepException): # An exception happened in the optional step. We can now raise it safely