def __init__(self, options: Options): super().__init__(options.for_global_scope().colors) self._bin_name = options.for_global_scope().pants_bin_name self._all_help_info = HelpInfoExtracter.get_all_help_info( options, # We only care about the options-related help info, so we pass in # dummy values for union_membership and consumed_scopes_mapper. UnionMembership({}), lambda x: tuple(), )
def __init__(self, options: Options): super().__init__(options.for_global_scope().colors) self._all_help_info = HelpInfoExtracter.get_all_help_info( options, # We only care about the options-related help info, so we pass in # dummy values for the other arguments. UnionMembership({}), lambda x: tuple(), RegisteredTargetTypes({}), )
def _print_help(self, request: HelpRequest) -> ExitCode: global_options = self.options.for_global_scope() all_help_info = HelpInfoExtracter.get_all_help_info( self.options, self.union_membership, self.graph_session.goal_consumed_subsystem_scopes, ) help_printer = HelpPrinter( bin_name=global_options.pants_bin_name, help_request=request, all_help_info=all_help_info, color=global_options.colors, ) return help_printer.print_help()
def run( self, build_config: BuildConfiguration, graph_session: GraphSession, options: Options, specs: Specs, union_membership: UnionMembership, ) -> ExitCode: for server_request_type in union_membership.get(ExplorerServerRequest): logger.info(f"Using {server_request_type.__name__} to create the explorer server.") break else: logger.error( softwrap( """ There is no Explorer backend server implementation registered. Activate a backend/plugin that registers an implementation for the `ExplorerServerRequest` union to fix this issue. """ ) ) return 127 all_help_info = HelpInfoExtracter.get_all_help_info( options, union_membership, graph_session.goal_consumed_subsystem_scopes, RegisteredTargetTypes.create(build_config.target_types), build_config, ) request_state = RequestState( all_help_info=all_help_info, build_configuration=build_config, scheduler_session=graph_session.scheduler_session, ) server_request = server_request_type( address=self.address, port=self.port, request_state=request_state, ) server = request_state.product_request( ExplorerServer, (server_request,), poll=True, timeout=90, ) return server.run()
def run( self, build_config: BuildConfiguration, graph_session: GraphSession, options: Options, specs: Specs, union_membership: UnionMembership, ) -> ExitCode: all_help_info = HelpInfoExtracter.get_all_help_info( options, union_membership, graph_session.goal_consumed_subsystem_scopes, RegisteredTargetTypes.create(build_config.target_types), build_config, ) global_options = options.for_global_scope() help_printer = HelpPrinter( help_request=self.create_help_request(options), all_help_info=all_help_info, color=global_options.colors, ) return help_printer.print_help()
def run(self, start_time: float) -> ExitCode: self._set_start_time(start_time) with maybe_profiled(self.profile_path): global_options = self.options.for_global_scope() streaming_handlers = global_options.streaming_workunits_handlers report_interval = global_options.streaming_workunits_report_interval callbacks = Subsystem.get_streaming_workunit_callbacks( streaming_handlers) streaming_reporter = StreamingWorkunitHandler( self.graph_session.scheduler_session, callbacks=callbacks, report_interval_seconds=report_interval, ) if self.options.help_request: all_help_info = HelpInfoExtracter.get_all_help_info( self.options, self.union_membership, self.graph_session.goal_consumed_subsystem_scopes, ) help_printer = HelpPrinter( bin_name=global_options.pants_bin_name, help_request=self.options.help_request, all_help_info=all_help_info, use_color=global_options.colors, ) return help_printer.print_help() with streaming_reporter.session(): engine_result = PANTS_FAILED_EXIT_CODE try: engine_result = self._run_v2() except Exception as e: ExceptionSink.log_exception(e) run_tracker_result = self._finish_run(engine_result) return self._merge_exit_codes(engine_result, run_tracker_result)
def test_get_all_help_info(): class Global(Subsystem): """Global options.""" options_scope = GLOBAL_SCOPE @classmethod def register_options(cls, register): register("-o", "--opt1", type=int, default=42, help="Option 1") class Foo(Subsystem): """A foo.""" options_scope = "foo" @classmethod def register_options(cls, register): register("--opt2", type=bool, default=True, help="Option 2") register("--opt3", advanced=True, choices=["a", "b", "c"]) class Bar(GoalSubsystem): """The bar goal.""" name = "bar" options = Options.create( env={}, config=Config.load_file_contents(""), known_scope_infos=[ Global.get_scope_info(), Foo.get_scope_info(), Bar.get_scope_info() ], args=["./pants"], bootstrap_option_values=None, ) Global.register_options_on_scope(options) Foo.register_options_on_scope(options) Bar.register_options_on_scope(options) def fake_consumed_scopes_mapper(scope: str) -> Tuple[str, ...]: return ("somescope", f"used_by_{scope or 'GLOBAL_SCOPE'}") all_help_info = HelpInfoExtracter.get_all_help_info( options, UnionMembership({}), fake_consumed_scopes_mapper) all_help_info_dict = dataclasses.asdict(all_help_info) expected_all_help_info_dict = { "scope_to_help_info": { GLOBAL_SCOPE: { "scope": GLOBAL_SCOPE, "description": "Global options.", "is_goal": False, "basic": ({ "display_args": ("-o=<int>", "--opt1=<int>"), "comma_separated_display_args": "-o=<int>, --opt1=<int>", "scoped_cmd_line_args": ("-o", "--opt1"), "unscoped_cmd_line_args": ("-o", "--opt1"), "config_key": "opt1", "env_var": "PANTS_OPT1", "value_history": { "ranked_values": ( { "rank": Rank.NONE, "value": None, "details": None }, { "rank": Rank.HARDCODED, "value": 42, "details": None }, ), }, "typ": int, "default": 42, "help": "Option 1", "deprecated_message": None, "removal_version": None, "removal_hint": None, "choices": None, "comma_separated_choices": None, }, ), "advanced": tuple(), "deprecated": tuple(), }, "foo": { "scope": "foo", "description": "A foo.", "is_goal": False, "basic": ({ "display_args": ("--[no-]foo-opt2", ), "comma_separated_display_args": "--[no-]foo-opt2", "scoped_cmd_line_args": ("--foo-opt2", "--no-foo-opt2"), "unscoped_cmd_line_args": ("--opt2", "--no-opt2"), "config_key": "opt2", "env_var": "PANTS_FOO_OPT2", "value_history": { "ranked_values": ( { "rank": Rank.NONE, "value": None, "details": None }, { "rank": Rank.HARDCODED, "value": True, "details": None }, ), }, "typ": bool, "default": True, "help": "Option 2", "deprecated_message": None, "removal_version": None, "removal_hint": None, "choices": None, "comma_separated_choices": None, }, ), "advanced": ({ "display_args": ("--foo-opt3=<str>", ), "comma_separated_display_args": "--foo-opt3=<str>", "scoped_cmd_line_args": ("--foo-opt3", ), "unscoped_cmd_line_args": ("--opt3", ), "config_key": "opt3", "env_var": "PANTS_FOO_OPT3", "value_history": { "ranked_values": ({ "rank": Rank.NONE, "value": None, "details": None }, ), }, "typ": str, "default": None, "help": "No help available.", "deprecated_message": None, "removal_version": None, "removal_hint": None, "choices": ("a", "b", "c"), "comma_separated_choices": "a, b, c", }, ), "deprecated": tuple(), }, "bar": { "scope": "bar", "description": "The bar goal.", "is_goal": True, "basic": tuple(), "advanced": tuple(), "deprecated": tuple(), }, }, "name_to_goal_info": { "bar": { "name": "bar", "description": "The bar goal.", "consumed_scopes": ("somescope", "used_by_bar"), "is_implemented": True, } }, } assert expected_all_help_info_dict == all_help_info_dict
def test_get_all_help_info(): class Global(Subsystem): options_scope = GLOBAL_SCOPE help = "Global options." @classmethod def register_options(cls, register): register("-o", "--opt1", type=int, default=42, help="Option 1") class Foo(Subsystem): options_scope = "foo" help = "A foo." @classmethod def register_options(cls, register): register("--opt2", type=bool, default=True, help="Option 2") register("--opt3", advanced=True, choices=["a", "b", "c"]) class Bar(GoalSubsystem): name = "bar" help = "The bar goal." class QuxField(StringField): alias = "qux" default = "blahblah" help = "A qux string." class QuuxField(IntField): alias = "quux" required = True help = "A quux int.\n\nMust be non-zero. Or zero. Whatever you like really." class BazLibrary(Target): alias = "baz_library" help = "A library of baz-es.\n\nUse it however you like." core_fields = [QuxField, QuuxField] options = Options.create( env={}, config=Config.load_file_contents(""), known_scope_infos=[ Global.get_scope_info(), Foo.get_scope_info(), Bar.get_scope_info() ], args=["./pants"], bootstrap_option_values=None, ) Global.register_options_on_scope(options) Foo.register_options_on_scope(options) Bar.register_options_on_scope(options) def fake_consumed_scopes_mapper(scope: str) -> Tuple[str, ...]: return ("somescope", f"used_by_{scope or 'GLOBAL_SCOPE'}") all_help_info = HelpInfoExtracter.get_all_help_info( options, UnionMembership({}), fake_consumed_scopes_mapper, RegisteredTargetTypes({BazLibrary.alias: BazLibrary}), ) all_help_info_dict = dataclasses.asdict(all_help_info) expected_all_help_info_dict = { "scope_to_help_info": { GLOBAL_SCOPE: { "scope": GLOBAL_SCOPE, "description": "Global options.", "is_goal": False, "basic": ({ "display_args": ("-o=<int>", "--opt1=<int>"), "comma_separated_display_args": "-o=<int>, --opt1=<int>", "scoped_cmd_line_args": ("-o", "--opt1"), "unscoped_cmd_line_args": ("-o", "--opt1"), "config_key": "opt1", "env_var": "PANTS_OPT1", "value_history": { "ranked_values": ( { "rank": Rank.NONE, "value": None, "details": None }, { "rank": Rank.HARDCODED, "value": 42, "details": None }, ), }, "typ": int, "default": 42, "help": "Option 1", "deprecation_active": False, "deprecated_message": None, "removal_version": None, "removal_hint": None, "choices": None, "comma_separated_choices": None, }, ), "advanced": tuple(), "deprecated": tuple(), }, "foo": { "scope": "foo", "description": "A foo.", "is_goal": False, "basic": ({ "display_args": ("--[no-]foo-opt2", ), "comma_separated_display_args": "--[no-]foo-opt2", "scoped_cmd_line_args": ("--foo-opt2", "--no-foo-opt2"), "unscoped_cmd_line_args": ("--opt2", "--no-opt2"), "config_key": "opt2", "env_var": "PANTS_FOO_OPT2", "value_history": { "ranked_values": ( { "rank": Rank.NONE, "value": None, "details": None }, { "rank": Rank.HARDCODED, "value": True, "details": None }, ), }, "typ": bool, "default": True, "help": "Option 2", "deprecation_active": False, "deprecated_message": None, "removal_version": None, "removal_hint": None, "choices": None, "comma_separated_choices": None, }, ), "advanced": ({ "display_args": ("--foo-opt3=<str>", ), "comma_separated_display_args": "--foo-opt3=<str>", "scoped_cmd_line_args": ("--foo-opt3", ), "unscoped_cmd_line_args": ("--opt3", ), "config_key": "opt3", "env_var": "PANTS_FOO_OPT3", "value_history": { "ranked_values": ({ "rank": Rank.NONE, "value": None, "details": None }, ), }, "typ": str, "default": None, "help": "No help available.", "deprecation_active": False, "deprecated_message": None, "removal_version": None, "removal_hint": None, "choices": ("a", "b", "c"), "comma_separated_choices": "a, b, c", }, ), "deprecated": tuple(), }, "bar": { "scope": "bar", "description": "The bar goal.", "is_goal": True, "basic": tuple(), "advanced": tuple(), "deprecated": tuple(), }, }, "name_to_goal_info": { "bar": { "name": "bar", "description": "The bar goal.", "consumed_scopes": ("somescope", "used_by_bar"), "is_implemented": True, } }, "name_to_target_type_info": { "baz_library": { "alias": "baz_library", "summary": "A library of baz-es.", "description": "A library of baz-es.\n\nUse it however you like.", "fields": ( { "alias": "qux", "default": "'blahblah'", "description": "A qux string.", "required": False, "type_hint": "str | None", }, { "alias": "quux", "default": None, "description": "A quux int.\n\nMust be non-zero. Or zero. " "Whatever you like really.", "required": True, "type_hint": "int", }, ), } }, } assert expected_all_help_info_dict == all_help_info_dict
def test_get_all_help_info(): class Global(Subsystem): options_scope = GLOBAL_SCOPE help = "Global options." opt1 = IntOption("-o", "--opt1", default=42, help="Option 1") class Foo(Subsystem): options_scope = "foo" help = "A foo." opt2 = BoolOption("--opt2", default=True, advanced=True, help="Option 2") class Bar(GoalSubsystem): name = "bar" help = "The bar goal." deprecated_options_scope = "bar-old" deprecated_options_scope_removal_version = "9.9.999" class QuxField(StringField): alias = "qux" default = "blahblah" help = "A qux string." class QuuxField(IntField): alias = "quux" required = True help = "A quux int.\n\nMust be non-zero. Or zero. Whatever you like really." class BazLibrary(Target): alias = "baz_library" help = "A library of baz-es.\n\nUse it however you like." core_fields = [QuxField, QuuxField] options = Options.create( env={}, config=Config.load([]), known_scope_infos=[ Global.get_scope_info(), Foo.get_scope_info(), Bar.get_scope_info() ], args=["./pants"], bootstrap_option_values=None, ) Global.register_options_on_scope(options) Foo.register_options_on_scope(options) Bar.register_options_on_scope(options) @rule def rule_info_test(foo: Foo) -> Target: """This rule is for testing info extraction only.""" def fake_consumed_scopes_mapper(scope: str) -> Tuple[str, ...]: return ("somescope", f"used_by_{scope or 'GLOBAL_SCOPE'}") bc_builder = BuildConfiguration.Builder() bc_builder.register_subsystems("help_info_extracter_test", (Foo, Bar)) bc_builder.register_target_types("help_info_extracter_test", (BazLibrary, )) bc_builder.register_rules("help_info_extracter_test", collect_rules(locals())) all_help_info = HelpInfoExtracter.get_all_help_info( options, UnionMembership({}), fake_consumed_scopes_mapper, RegisteredTargetTypes({BazLibrary.alias: BazLibrary}), bc_builder.create(), ) all_help_info_dict = all_help_info.asdict() expected_all_help_info_dict = { "scope_to_help_info": { GLOBAL_SCOPE: { "scope": GLOBAL_SCOPE, "description": "Global options.", "provider": "", "is_goal": False, "deprecated_scope": None, "basic": ({ "display_args": ("-o=<int>", "--opt1=<int>"), "comma_separated_display_args": "-o=<int>, --opt1=<int>", "scoped_cmd_line_args": ("-o", "--opt1"), "unscoped_cmd_line_args": ("-o", "--opt1"), "config_key": "opt1", "env_var": "PANTS_OPT1", "value_history": { "ranked_values": ( { "rank": Rank.NONE, "value": None, "details": None }, { "rank": Rank.HARDCODED, "value": 42, "details": None }, ), }, "typ": int, "default": 42, "help": "Option 1", "deprecation_active": False, "deprecated_message": None, "removal_version": None, "removal_hint": None, "choices": None, "comma_separated_choices": None, }, ), "advanced": tuple(), "deprecated": tuple(), }, "foo": { "scope": "foo", "provider": "help_info_extracter_test", "description": "A foo.", "is_goal": False, "deprecated_scope": None, "basic": (), "advanced": ({ "display_args": ("--[no-]foo-opt2", ), "comma_separated_display_args": "--[no-]foo-opt2", "scoped_cmd_line_args": ("--foo-opt2", "--no-foo-opt2"), "unscoped_cmd_line_args": ("--opt2", "--no-opt2"), "config_key": "opt2", "env_var": "PANTS_FOO_OPT2", "value_history": { "ranked_values": ( { "rank": Rank.NONE, "value": None, "details": None }, { "rank": Rank.HARDCODED, "value": True, "details": None }, ), }, "typ": bool, "default": True, "help": "Option 2", "deprecation_active": False, "deprecated_message": None, "removal_version": None, "removal_hint": None, "choices": None, "comma_separated_choices": None, }, ), "deprecated": tuple(), }, "bar": { "scope": "bar", "provider": "help_info_extracter_test", "description": "The bar goal.", "is_goal": True, "deprecated_scope": "bar-old", "basic": tuple(), "advanced": tuple(), "deprecated": tuple(), }, "bar-old": { "scope": "bar-old", "provider": "help_info_extracter_test", "description": "The bar goal.", "is_goal": True, "deprecated_scope": "bar-old", "basic": tuple(), "advanced": tuple(), "deprecated": tuple(), }, }, "rule_output_type_to_rule_infos": { "Foo": ({ "description": None, "help": "A foo.", "input_gets": ("Get(ScopedOptions, Scope, ..)", ), "input_types": (), "name": "construct_scope_foo", "output_desc": None, "output_type": "Foo", "provider": "help_info_extracter_test", }, ), "Target": ({ "description": None, "help": "This rule is for testing info extraction only.", "input_gets": (), "input_types": ("Foo", ), "name": "pants.help.help_info_extracter_test.rule_info_test", "output_desc": ("A Target represents an addressable set of metadata.\n\n Set the " "`help` class property with a description, which will be used in " "`./pants help`. For the\n best rendering, use soft wrapping (e.g. " "implicit string concatenation) within paragraphs, but\n hard wrapping " "(`\n`) to separate distinct paragraphs and/or lists.\n "), "output_type": "Target", "provider": "help_info_extracter_test", }, ), }, "name_to_goal_info": { "bar": { "name": "bar", "provider": "help_info_extracter_test", "description": "The bar goal.", "consumed_scopes": ("somescope", "used_by_bar"), "is_implemented": True, }, "bar-old": { "name": "bar", "provider": "help_info_extracter_test", "description": "The bar goal.", "consumed_scopes": ("somescope", "used_by_bar-old"), "is_implemented": True, }, }, "name_to_target_type_info": { "baz_library": { "alias": "baz_library", "provider": "help_info_extracter_test", "summary": "A library of baz-es.", "description": "A library of baz-es.\n\nUse it however you like.", "fields": ( { "alias": "qux", "provider": "", "default": "'blahblah'", "description": "A qux string.", "required": False, "type_hint": "str | None", }, { "alias": "quux", "provider": "", "default": None, "description": "A quux int.\n\nMust be non-zero. Or zero. " "Whatever you like really.", "required": True, "type_hint": "int", }, ), } }, } assert expected_all_help_info_dict == all_help_info_dict
def test_get_all_help_info(): class Global(Subsystem): options_scope = GLOBAL_SCOPE help = "Global options." opt1 = IntOption("--opt1", default=42, help="Option 1") # This is special in having a short option `-l`. Make sure it works. level = LogLevelOption() class Foo(Subsystem): options_scope = "foo" help = "A foo." opt2 = BoolOption("--opt2", default=True, advanced=True, help="Option 2") class Bar(GoalSubsystem): name = "bar" help = "The bar goal." deprecated_options_scope = "bar-old" deprecated_options_scope_removal_version = "9.9.999" class QuxField(StringField): alias = "qux" default = "blahblah" help = "A qux string." class QuuxField(IntField): alias = "quux" required = True help = "A quux int.\n\nMust be non-zero. Or zero. Whatever you like really." class BazLibrary(Target): alias = "baz_library" help = "A library of baz-es.\n\nUse it however you like." core_fields = [QuxField, QuuxField] options = Options.create( env={}, config=Config.load([]), known_scope_infos=[ Global.get_scope_info(), Foo.get_scope_info(), Bar.get_scope_info() ], args=["./pants"], bootstrap_option_values=None, ) Global.register_options_on_scope(options) Foo.register_options_on_scope(options) Bar.register_options_on_scope(options) @rule def rule_info_test(foo: Foo) -> Target: """This rule is for testing info extraction only.""" def fake_consumed_scopes_mapper(scope: str) -> Tuple[str, ...]: return ("somescope", f"used_by_{scope or 'GLOBAL_SCOPE'}") bc_builder = BuildConfiguration.Builder() bc_builder.register_subsystems("help_info_extracter_test", (Foo, Bar)) bc_builder.register_target_types("help_info_extracter_test", (BazLibrary, )) bc_builder.register_rules("help_info_extracter_test", collect_rules(locals())) all_help_info = HelpInfoExtracter.get_all_help_info( options, UnionMembership({}), fake_consumed_scopes_mapper, RegisteredTargetTypes({BazLibrary.alias: BazLibrary}), bc_builder.create(), ) all_help_info_dict = all_help_info.asdict() expected_all_help_info_dict = { "scope_to_help_info": { GLOBAL_SCOPE: { "scope": GLOBAL_SCOPE, "description": "Global options.", "provider": "", "is_goal": False, "deprecated_scope": None, "basic": ( { "display_args": ("--opt1=<int>", ), "comma_separated_display_args": "--opt1=<int>", "scoped_cmd_line_args": ("--opt1", ), "unscoped_cmd_line_args": ("--opt1", ), "config_key": "opt1", "env_var": "PANTS_OPT1", "value_history": { "ranked_values": ( { "rank": Rank.NONE, "value": None, "details": None }, { "rank": Rank.HARDCODED, "value": 42, "details": None }, ), }, "typ": int, "default": 42, "help": "Option 1", "deprecation_active": False, "deprecated_message": None, "removal_version": None, "removal_hint": None, "choices": None, "comma_separated_choices": None, }, { "display_args": ("-l=<LogLevel>", "--level=<LogLevel>"), "comma_separated_display_args": "-l=<LogLevel>, --level=<LogLevel>", "scoped_cmd_line_args": ("-l", "--level"), "unscoped_cmd_line_args": ("-l", "--level"), "config_key": "level", "env_var": "PANTS_LEVEL", "value_history": { "ranked_values": ( { "rank": Rank.NONE, "value": None, "details": None }, { "rank": Rank.HARDCODED, "value": LogLevel.INFO, "details": None }, ), }, "typ": LogLevel, "default": LogLevel.INFO, "help": "Set the logging level.", "deprecation_active": False, "deprecated_message": None, "removal_version": None, "removal_hint": None, "choices": ("trace", "debug", "info", "warn", "error"), "comma_separated_choices": "trace, debug, info, warn, error", }, ), "advanced": tuple(), "deprecated": tuple(), }, "foo": { "scope": "foo", "provider": "help_info_extracter_test", "description": "A foo.", "is_goal": False, "deprecated_scope": None, "basic": (), "advanced": ({ "display_args": ("--[no-]foo-opt2", ), "comma_separated_display_args": "--[no-]foo-opt2", "scoped_cmd_line_args": ("--foo-opt2", "--no-foo-opt2"), "unscoped_cmd_line_args": ("--opt2", "--no-opt2"), "config_key": "opt2", "env_var": "PANTS_FOO_OPT2", "value_history": { "ranked_values": ( { "rank": Rank.NONE, "value": None, "details": None }, { "rank": Rank.HARDCODED, "value": True, "details": None }, ), }, "typ": bool, "default": True, "help": "Option 2", "deprecation_active": False, "deprecated_message": None, "removal_version": None, "removal_hint": None, "choices": None, "comma_separated_choices": None, }, ), "deprecated": tuple(), }, "bar": { "scope": "bar", "provider": "help_info_extracter_test", "description": "The bar goal.", "is_goal": True, "deprecated_scope": "bar-old", "basic": tuple(), "advanced": tuple(), "deprecated": tuple(), }, "bar-old": { "scope": "bar-old", "provider": "help_info_extracter_test", "description": "The bar goal.", "is_goal": True, "deprecated_scope": "bar-old", "basic": tuple(), "advanced": tuple(), "deprecated": tuple(), }, }, "name_to_goal_info": { "bar": { "name": "bar", "provider": "help_info_extracter_test", "description": "The bar goal.", "consumed_scopes": ("somescope", "used_by_bar"), "is_implemented": True, }, "bar-old": { "name": "bar", "provider": "help_info_extracter_test", "description": "The bar goal.", "consumed_scopes": ("somescope", "used_by_bar-old"), "is_implemented": True, }, }, "name_to_target_type_info": { "baz_library": { "alias": "baz_library", "provider": "help_info_extracter_test", "summary": "A library of baz-es.", "description": "A library of baz-es.\n\nUse it however you like.", "fields": ( { "alias": "qux", "provider": "", "default": "'blahblah'", "description": "A qux string.", "required": False, "type_hint": "str | None", }, { "alias": "quux", "provider": "", "default": None, "description": "A quux int.\n\nMust be non-zero. Or zero. " "Whatever you like really.", "required": True, "type_hint": "int", }, ), } }, "name_to_rule_info": { "construct_scope_foo": { "description": None, "documentation": "A foo.", "input_gets": ("Get(ScopedOptions, Scope, ..)", ), "input_types": (), "name": "construct_scope_foo", "output_type": "Foo", "provider": "help_info_extracter_test", }, "pants.help.help_info_extracter_test.test_get_all_help_info.rule_info_test": { "description": None, "documentation": "This rule is for testing info extraction only.", "input_gets": (), "input_types": ("Foo", ), "name": "pants.help.help_info_extracter_test.test_get_all_help_info.rule_info_test", "output_type": "Target", "provider": "help_info_extracter_test", }, }, "name_to_api_type_info": { "pants.help.help_info_extracter_test.Foo": { "consumed_by_rules": ("pants.help.help_info_extracter_test.test_get_all_help_info.rule_info_test", ), "dependees": ("help_info_extracter_test", ), "dependencies": ("pants.option.scope", ), "documentation": None, "is_union": False, "module": "pants.help.help_info_extracter_test", "name": "Foo", "provider": "help_info_extracter_test", "returned_by_rules": ("construct_scope_foo", ), "union_members": (), "union_type": None, "used_in_rules": (), }, "pants.engine.target.Target": { "consumed_by_rules": (), "dependees": (), "dependencies": (), "documentation": ("A Target represents an addressable set of metadata.\n\n Set the `help` " "class property with a description, which will be used in `./pants help`. For " "the\n best rendering, use soft wrapping (e.g. implicit string concatenation" ") within paragraphs, but\n hard wrapping (`\n`) to separate distinct " "paragraphs and/or lists.\n "), "is_union": False, "module": "pants.engine.target", "name": "Target", "provider": "help_info_extracter_test", "returned_by_rules": ("pants.help.help_info_extracter_test.test_get_all_help_info.rule_info_test", ), "union_members": (), "union_type": None, "used_in_rules": (), }, "pants.option.scope.Scope": { "consumed_by_rules": (), "dependees": (), "dependencies": (), "documentation": "An options scope.", "is_union": False, "module": "pants.option.scope", "name": "Scope", "provider": "pants.option.scope", "returned_by_rules": (), "union_members": (), "union_type": None, "used_in_rules": ("construct_scope_foo", ), }, }, } # Break down this colossal structure into pieces so it is easier to spot where the issue is. # Check keys equality first, then contents assert set(expected_all_help_info_dict) == set(all_help_info_dict) for key in all_help_info_dict: actual = all_help_info_dict[key] expected = expected_all_help_info_dict[key] assert expected == actual