diff --git a/src/onestep/onestep.py b/src/onestep/onestep.py index 6d3cc16..96b54c3 100644 --- a/src/onestep/onestep.py +++ b/src/onestep/onestep.py @@ -241,6 +241,7 @@ def __init__(self, } def __call__(self, func, *_args, **_kwargs): + func.__step_params__ = self.params if iscoroutinefunction(func) or isasyncgenfunction(func): os = AsyncOneStep(fn=func, **self.params) else: diff --git a/tests/test_step_params.py b/tests/test_step_params.py new file mode 100644 index 0000000..da441bc --- /dev/null +++ b/tests/test_step_params.py @@ -0,0 +1,20 @@ +import pytest + +from onestep import step +from onestep.broker import MemoryBroker + + +@pytest.fixture +def broker(): + return MemoryBroker() + + +def test_func(broker): + + @step(from_broker=broker, name="do_some_thing") + def do_some_thing(message): + ... + assert do_some_thing.__step_params__ is not None + + assert do_some_thing.__step_params__["from_broker"] == broker + assert do_some_thing.__step_params__["name"] == "do_some_thing" \ No newline at end of file