fast-nail-55400
05/20/2025, 8:35 PMRuleRunner.do_not_use_mock
in a world of call-by-name rules? https://github.com/pantsbuild/pants/blob/2289117d3bf6268f8a1707e5bac2918df8055317/src/python/pants/testutil/rule_runner.py#L629fast-nail-55400
05/20/2025, 8:38 PMRuleRunner.request
to get the unmocked value. We would likely need a call-by-name sync invocation API to support that kind of use.
Instead, I'm leaning toward either the function for the mock_call returning a "run original call" sentinel or just setting the function value in the mock_calls
to a similar sentinel. RuleRunner
would then just avoid using a mock for that call.
Thoughts?fast-nail-55400
05/20/2025, 8:38 PMdo_not_use_mock
.)fast-nail-55400
05/20/2025, 8:42 PMPyGeneratorResponseCall
appears to have input_types
and output_type
attributes so invoking RuleRunner.request
might work.fast-nail-55400
05/20/2025, 8:46 PMdo_not_use_mock
as it expects.happy-kitchen-89482
05/20/2025, 8:46 PMhappy-kitchen-89482
05/20/2025, 8:47 PMrequest()
for call-by-name to support this, and other useshappy-kitchen-89482
05/20/2025, 8:48 PMmock_calls
being not strings but actual function references, to make this easier?fast-nail-55400
05/20/2025, 8:49 PMdiff --git a/src/python/pants/core/goals/export_test.py b/src/python/pants/core/goals/export_test.py
index c0017134a5..2f97f8d82f 100644
--- a/src/python/pants/core/goals/export_test.py
+++ b/src/python/pants/core/goals/export_test.py
@@ -146,6 +146,9 @@ def run_export_rule(
DistDir(relpath=Path("dist")),
create_subsystem(ExportSubsystem, resolve=resolves, bin=binaries),
],
+ mock_calls={
+ "pants.engine.intrinsics.add_prefix": lambda *xs: rule_runner.request(Digest, xs),
+ },
mock_gets=[
MockGet(
output_type=ExportResults,
fast-nail-55400
05/20/2025, 8:51 PMdo_not_use_mock
doeshappy-kitchen-89482
05/20/2025, 9:58 PMhappy-kitchen-89482
05/20/2025, 9:58 PM