def test_namespace_values(self): optionset = _option_set.OptionSet() optionset.add_options(_option_set.Option("option_a", default="meep")) namespace = optionset.namespace(option_a="moop") assert namespace.option_a == "moop"
def test_namespace(self): optionset = _option_set.OptionSet() optionset.add_options(_option_set.Option("option_a", default="meep")) namespace = optionset.namespace() assert hasattr(namespace, "option_a") assert not hasattr(namespace, "non_existant_option") assert namespace.option_a == "meep"
def test_parser_groupless_option(self): optionset = _option_set.OptionSet() optionset.add_options( _option_set.Option("oh_no_i_have_no_group", group=None, default="meep")) with pytest.raises(ValueError): optionset.parser()
def test_namespace_values(self): optionset = _option_set.OptionSet() optionset.add_groups(_option_set.OptionGroup("group_a")) optionset.add_options( _option_set.Option("option_a", group=optionset.groups["group_a"], default="meep")) namespace = optionset.namespace(option_a="moop") assert namespace.option_a == "moop"
def test_parser_hidden_option(self): optionset = _option_set.OptionSet() optionset.add_options( _option_set.Option("oh_boy_i_am_hidden", hidden=True, group=None, default="meep")) parser = optionset.parser() namespace = parser.parse_args([]) optionset._finalize_args(namespace) assert namespace.oh_boy_i_am_hidden == "meep"
module = load_nox_module(global_config) manifest = discover_manifest(module, global_config) filtered_manifest = filter_manifest(manifest, global_config) if isinstance(filtered_manifest, int): return [] return [ session.friendly_name for session, _ in filtered_manifest.list_all_sessions() ] options.add_options( _option_set.Option( "help", "-h", "--help", group=options.groups["primary"], action="store_true", help="Show this help message and exit.", ), _option_set.Option( "version", "--version", group=options.groups["primary"], action="store_true", help="Show the Nox version and exit.", ), _option_set.Option( "list_sessions", "-l", "--list-sessions", "--list",
module = load_nox_module(global_config) manifest = discover_manifest(module, global_config) filtered_manifest = filter_manifest(manifest, global_config) if isinstance(filtered_manifest, int): return [] return [ session.friendly_name for session, _ in filtered_manifest.list_all_sessions() ] options.add_options( _option_set.Option( "help", "-h", "--help", group=options.groups["general"], action="store_true", help="Show this help message and exit.", ), _option_set.Option( "version", "--version", group=options.groups["general"], action="store_true", help="Show the Nox version and exit.", ), _option_set.Option( "list_sessions", "-l", "--list-sessions", "--list",
def _session_completer(prefix, parsed_args, **kwargs): global_config = parsed_args module = load_nox_module(global_config) manifest = discover_manifest(module, global_config) filtered_manifest = filter_manifest(manifest, global_config) return [ session.friendly_name for session, _ in filtered_manifest.list_all_sessions() ] options.add_options( _option_set.Option( "help", "-h", "--help", group="primary", action="store_true", help="Show this help message and exit.", ), _option_set.Option( "version", "--version", group="primary", action="store_true", help="Show the Nox version and exit.", ), _option_set.Option( "list_sessions", "-l", "--list-sessions", "--list",