hey folks, for testing, if I have a rule, I can te...
# development
c
hey folks, for testing, if I have a rule, I can test it with `rule_runner.request(...)`; is there something similar for a rule_helper?
I've found an instance of an ad-hoc wrapper rule, which you register in the RuleRunner:
Copy code
@rule
    async def run_rule(
        request: UniqueICsRequest, python_setup: PythonSetup
    ) -> InterpreterConstraints:
        ...
This works well enough, but is some extra boilerplate. Thoughts/opinions on constructing this automatically? so you could do something like:
Copy code
RuleRunner(
    rules=[
        ...
        CallableRuleHelper(_my_rule_helper),
    ],
    ...
)
To me, it feels similar to adding a QueryRule. An alternative I could see would be to make a parallel to
RuleRunner.request
that executes rule_helpers
h
@bitter-ability-32190 thoughts?
b
It's not really a rule it's just an async function. Of wait but it has Gets... Idk I think @witty-crayon-22786 probably has a the most natural solution to this 😅
Having a helper which makes it callable like a normal rule doesn't sound bad to me 😄
w
yea, it should be easy to do with the same
run_rule_with_mocks
code, since the way it executes is identical