Open bobturneruk opened 2 years ago
extends to the @when and @then decorators as well
Used vscode debugger to track down definition and execution of decorators via:
from behave.__main__ import main as behave_main
behave_main("./features/")
Definition goes on around here (I think):
@given
, @when
and @then
decorators are apparently the same apart from their name. I think I need to learn more about how step_impl
functions are decorated. This probably means unravelling the sequence of event in punner.py
https://github.com/behave/behave/blob/master/behave/runner.py.
I was able to replicate this issue in a simple example with two of these:
@given('we have behave installed')
def step_impl(context):
...
in separate files.
After a meeting with @AndrewC19 it turns out that that this extends beyond just the step definitions to all aspects of the causecumber framework. We will also possibly need to override/extend the (actual) hook methods like before_feature
, before_tag
, etc. to enable us to do what we need to to get causecumber running while still allowing users to extend and add functionality.
@given
decorators, part of the behave package take a string as a argument. This argument matches a "given" statement in a feature file, and executes the decorated function, typicallystep_impl
on the basis of this.If the same string is passed to two
@given
decorators in a single run, it causes an error. We would like for@given
decorators in imported modules to be "overriden" by other statements, allowing default behaviour to be changed for specific cases.Relates to https://github.com/CITCOM-project/causcumber/issues/20 and https://github.com/behave/behave/issues/630