big-crayon-94763
07/05/2023, 3:19 PMException: No installed QueryRules can compute BuiltPackage given input Params(RPMFieldSet), but it can be produced using:
Params((EnvironmentName, RPMFieldSet))
my test code is pretty similar to how I see other packaging rules (like go_binary and debian) being tested:
@pytest.fixture
def rule_runner() -> RuleRunner:
return RuleRunner(
rules=[
*rpm_rules(),
*source_files_rules(),
*environment_rules(),
*package_rules(),
],
target_types=[RPMTarget],
inherent_environment=None,
)
def build_package(rule_runner: RuleRunner, target: RPMTarget) -> BuiltPackage:
field_set = RPMFieldSet.create(target)
result = rule_runner.request(BuiltPackage, [field_set])
rule_runner.write_digest(result.digest)
return result
The main difference being I need to run inside my environment. If I remove the inherent_environment=None,
then it runs but fails because it can’t run the build outside of the environment. I’ve tried a bunch of things but I can’t get the test to figure out the environment. Does anyone have any ideas or see what I am doing wrong?curved-television-6568
07/05/2023, 5:54 PMQueryRule(BuiltPackage, (RPMFieldSet,)),
from any of those rules methods?big-crayon-94763
07/05/2023, 5:56 PMasync def build_rpm(field_set: RPMFieldSet) -> BuiltPackage:
and
def rules():
return [*collect_rules(), UnionRule(PackageFieldSet, RPMFieldSet)]
and that is all. This works when using pants though and I am allowing all of the package rules in my test so I am confused about what is differentcurved-television-6568
07/05/2023, 6:05 PMQueryRule
in your test in order to use rule_runner.request(…)
as an entry point into the rule graph.curved-television-6568
07/05/2023, 6:06 PMrules
param when creating the test RuleRunnercurved-television-6568
07/05/2023, 6:07 PMbig-crayon-94763
07/05/2023, 6:08 PMValueError: Encountered 21 rule graph errors:
No installed rules return the type EnvironmentAwarePackageRequest,
curved-television-6568
07/05/2023, 6:15 PMcurved-television-6568
07/05/2023, 6:15 PMresult = rule_runner.request(BuiltPackage, [EnvironmentAwarePackageRequest(field_set)])
curved-television-6568
07/05/2023, 6:16 PMcurved-television-6568
07/05/2023, 6:16 PMbig-crayon-94763
07/05/2023, 6:17 PMbig-crayon-94763
07/05/2023, 6:18 PMcurved-television-6568
07/05/2023, 6:19 PMcurved-television-6568
07/05/2023, 6:20 PMbig-crayon-94763
07/05/2023, 6:21 PMQueryRule(BuiltPackage, (EnvironmentAwarePackageRequest,)),
with this I am now getting an error about the environment I want not being found which is progress!curved-television-6568
07/05/2023, 6:21 PMbig-crayon-94763
07/05/2023, 6:26 PM