Skip to content

Commit

Permalink
Empty groupname will be 'DEFAULT' by default
Browse files Browse the repository at this point in the history
By default, if the groupname is None, set it to 'DEFAULT'.
Seems like several libraries are exporting such groups, and it causes
sorting the 'by_section.items()' list to fail.

Change-Id: I2001dc4894ff1e24c0eaed9ba71e3c5fba02ae36
  • Loading branch information
jhamhader committed Jul 25, 2017
1 parent dfc70fa commit d7931f2
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
4 changes: 4 additions & 0 deletions oslo_config/sphinxext.py
Expand Up @@ -206,6 +206,8 @@ def _format_option_help(app, namespaces, split_namespaces):
else:
group_name = group
group = None
if group_name is None:
group_name = 'DEFAULT'
lines = _format_group(
app=app,
namespace=namespace,
Expand All @@ -228,6 +230,8 @@ def _format_option_help(app, namespaces, split_namespaces):
else:
group_name = group
group = None
if group_name is None:
group_name = 'DEFAULT'
group_objs.setdefault(group_name, group)
by_section.setdefault(group_name, []).extend(group_opts)
for group_name, group_opts in sorted(by_section.items()):
Expand Down
6 changes: 3 additions & 3 deletions oslo_config/tests/test_sphinxext.py
Expand Up @@ -403,14 +403,14 @@ def test_split_namespaces(self, _format_group, _list_opts):
_format_group.assert_any_call(
app=None,
namespace='namespace1',
group_name=None,
group_name='DEFAULT',
group_obj=None,
opt_list=['opt1'],
)
_format_group.assert_any_call(
app=None,
namespace='namespace2',
group_name=None,
group_name='DEFAULT',
group_obj=None,
opt_list=['opt2'],
)
Expand All @@ -429,7 +429,7 @@ def test_dont_split_namespaces(self, _format_group, _list_opts):
_format_group.assert_called_once_with(
app=None,
namespace=None,
group_name=None,
group_name='DEFAULT',
group_obj=None,
opt_list=['opt1', 'opt2'],
)
Expand Down

0 comments on commit d7931f2

Please sign in to comment.