Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Fix AttributeError with docutils >= 0.18 #352

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/catkin_pkg/cli/tag_changelog.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def get_forthcoming_label(rst):
if len(section.children) > 0 and isinstance(section.children[0], docutils.nodes.title):
title = section.children[0]
if title and len(title.children) > 0 and isinstance(title.children[0], docutils.nodes.Text):
title_text = title.children[0].rawsource
title_text = title.children[0]
if FORTHCOMING_LABEL.lower() in title_text.lower():
if forthcoming_label:
raise RuntimeError('Found multiple forthcoming sections')
Expand Down
43 changes: 43 additions & 0 deletions test/test_tag_changelog.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# coding=utf-8

from catkin_pkg.cli.tag_changelog import get_forthcoming_label
from catkin_pkg.cli.tag_changelog import rename_section

single_forthcoming_rst = """\
^^^^^^^^^^^^^^^^^^^^^^^^^
Changelog for package foo
^^^^^^^^^^^^^^^^^^^^^^^^^

Forthcoming
-----------

* Initial release
* Initial bugs
* Contributors: Sömeöne with UTF-8 in their name
"""

single_version_rst = """\
^^^^^^^^^^^^^^^^^^^^^^^^^
Changelog for package foo
^^^^^^^^^^^^^^^^^^^^^^^^^

0.0.1 (2012-01-31)
------------------

* Initial release
* Initial bugs
* Contributors: Sömeöne with UTF-8 in their name
"""


def test_get_forthcoming_label():
assert get_forthcoming_label(single_version_rst) is None
assert get_forthcoming_label(single_forthcoming_rst) == 'Forthcoming'


def test_rename_section():
res = rename_section(
single_forthcoming_rst,
'Forthcoming',
'0.0.1 (2012-01-31)')
assert res == single_version_rst
Loading