Invoke lifecycles directly in test (as in code)
@@ -5,7 +5,6 @@ import pytest
import kopf
from kopf.reactor.causation import ResourceChangingCause
from kopf.reactor.indexing import OperatorIndexers
-from kopf.reactor.invocation import invoke
from kopf.storage.states import State
from kopf.structs.bodies import Body
from kopf.structs.ephemera import Memo
@@ -38,6 +37,6 @@ async def test_protocol_invocation(lifecycle, resource):
reason=Reason.NOOP,
)
handlers = []
- selected = await invoke(lifecycle, handlers, cause=cause, state=state)
+ selected = lifecycle(handlers, state=state, **cause.kwargs)
assert isinstance(selected, (tuple, list))
assert len(selected) == 0
