polite-garden-50641
09/30/2020, 3:48 AMfrom pants.option.subsystem.Subsystem specifically, I need to have my CustomSubsystem.global_instance() method to not blow up. using pants.testutil.option_util.create_subsystem doesn't cause global_instance() to work. couldn't find any info in the docs: https://www.pantsbuild.org/docs/rules-api-testing (also note that the page title: Testing plugins doesn't match the url, ideally those should match)hundreds-father-404
09/30/2020, 3:51 AMrule_runner.request(MySubsystem, []). Use rule_runner.set_options() beforehand if you want to use non-default valuespolite-garden-50641
09/30/2020, 4:09 AMhundreds-father-404
09/30/2020, 4:15 AMWhat do I pass to set_options ?https://www.pantsbuild.org/docs/rules-api-testing#setting-options
polite-garden-50641
09/30/2020, 3:09 PMpolite-garden-50641
09/30/2020, 3:10 PMhundreds-father-404
09/30/2020, 4:19 PMrule_runner.request(MySubsystem, [create_options_bootstrapper(args=['--my-arg']), which is exported from pants.testutil.option_utilpolite-garden-50641
09/30/2020, 7:06 PMhundreds-father-404
09/30/2020, 7:07 PMQueryRule(AuthStore, [OptionsBootstrapper]) to the RuleRunner(rules=[]) argumenthundreds-father-404
09/30/2020, 7:08 PMQueryRule from pants.testutil.rule_runner (otherwise pants.engine.rules), and then pants.option.options_bootstrapperpolite-garden-50641
09/30/2020, 7:14 PMpolite-garden-50641
09/30/2020, 7:14 PMhundreds-father-404
09/30/2020, 7:16 PMpolite-garden-50641
09/30/2020, 7:31 PMpolite-garden-50641
09/30/2020, 10:19 PMrule_runner = RuleRunner(rules=[QueryRule(AuthStore, [OptionsBootstrapper])])
rule_runner.set_options(args=["--toolchain-setup-repo=puddy", "--buildsense-base-url=<http://little.jerry.com/chicken>", "--auth-from-env-var=CAGE_FREE"])
rule_runner.request(AuthStore, [])polite-garden-50641
09/30/2020, 10:20 PMAuthStore inherits from Subsystem not GoalSubsystemhundreds-father-404
09/30/2020, 10:22 PMhundreds-father-404
10/01/2020, 12:01 AMpolite-garden-50641
10/01/2020, 6:11 PMpolite-garden-50641
10/01/2020, 8:07 PMhundreds-father-404
10/01/2020, 8:23 PMQueryRule(AuthStore, [])polite-garden-50641
10/01/2020, 9:18 PMhundreds-father-404
10/01/2020, 9:24 PMSubsystemRule(AuthStore) in the RuleRunner, in addition to the QueryRule. this is exported from pants.engine.rules
It’s really rare to need to register a SubsystemRule now because these get included when you use collect_rules() in a source file. Normally, in your test setup, you would register something like my_plugin.rules(), which will include that SubsystemRule. But here, you’re not registering anything but the QueryRule, so Pants doesn’t know your subsystem exists.
Sorry that took so long to figure out.polite-garden-50641
10/01/2020, 9:30 PM