From 128189e7ab01a2cb15cfcc51549efd109f17818d Mon Sep 17 00:00:00 2001 From: Peter Van Dyken Date: Thu, 15 Feb 2024 11:25:21 -0500 Subject: [PATCH] Do not remove default arg groups from group map The default names change across versions (e.g. 'optional arguments' changes to 'options' in py311), adding a maintenance burden to keep this. And there's no obvious benefit to keeping it. --- snakebids/bidsapp/run.py | 5 +---- snakebids/tests/test_bidsapp.py | 4 ++-- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/snakebids/bidsapp/run.py b/snakebids/bidsapp/run.py index 7b8179aa..894da89f 100644 --- a/snakebids/bidsapp/run.py +++ b/snakebids/bidsapp/run.py @@ -168,10 +168,7 @@ def build_parser(self): if not self._parser_built: self.pm.hook.initialize_config(config=self.config) for group in self.parser._action_groups: # noqa: SLF001 - if group.title is not None and group.title not in { - "positional arguments", - "optional arguments", - }: + if group.title is not None: self.argument_groups[group.title] = group self.pm.hook.add_cli_arguments( parser=self.parser, diff --git a/snakebids/tests/test_bidsapp.py b/snakebids/tests/test_bidsapp.py index a22307ac..6e2d0e1c 100644 --- a/snakebids/tests/test_bidsapp.py +++ b/snakebids/tests/test_bidsapp.py @@ -31,7 +31,7 @@ def add_cli_arguments( assert len(config) == 1 assert config["initialized"] assert len(parser._actions) == 1 - assert not argument_groups + assert len(argument_groups) == 2 config["added_args"] = True parser.add_argument("arg_one") parser.add_argument("--arg-two") @@ -192,5 +192,5 @@ def test_argument_groups_visible_to_add_arg_hook(self): app.parser.add_argument_group("foo") app.run() assert self.group_names - assert set(self.group_names) == {"foo", "new"} + assert set(self.group_names).issuperset({"foo", "new"}) assert app.argument_groups["new"].title == "new"