Any recommendations on testing strats for `Builtin...
# development
w
Any recommendations on testing strats for
BuiltinGoal
? https://www.pantsbuild.org/docs/rules-api-testing#approach-2-run_rule_with_mocks-unit-tests-for-rules has 4 recommendations, and the one that seems to apply is unfortunately the slowest (approach 4). Alternatively, I could pass a bunch of mocks into
Copy code
def run(
        self,
        build_config: BuildConfiguration,
        graph_session: GraphSession,
        options: Options,
        specs: Specs,
        union_membership: UnionMembership,
    ) -> ExitCode:
but that almost feels like I'd be bypassing anything resembling reality for this kind completions test, as the input is pretty critical here
Approach 4 is fine, obvs, just trying to err on the side of the fastest test possible, for the given coverage
However, since I am currently only using the passed in Options/scope, maybe it's reasonable to do something close to what is done for the
options_test.py
and manually create the options container, and pass that in 🤷
And I do sense that these
create_options_bootstrapper
and
create_goal_subsystem
utils should be highly relevant
To quantify this, my
run_pants
tests for the completions takes 25 seconds on my Mac Mini M2 - which is a brutally long time